Authentication and Making API Calls
POST
const baseUrl = "https://api.wattshift.com/v1"; const options = { method: "POST", headers: { "x-ws-api-key": "<your api key here>", }, }; const wattshiftApiCall = async ( path: `/${string}`, body?: Record<string, any>, ) => { const res = await fetch(`${url}${path}`, { ...options, body: JSON.stringify(body ?? {}), }); return res.json(); };
await wattShiftApiCall(`/homes/${user.wsHomeId}/update`, { name: "updated home name", });