f365.http, typed HTTP client

Get / post / put / delete with JSON parsing. Throws on non-2xx, no need to check response.ok.

The f365.http namespace is a thin typed wrapper around fetch. It parses JSON automatically, throws on non-2xx responses (no need to check

response.ok), and forwards SharePoint Forms365 auth cookies on same-origin calls.

Surface

PropertyDescription
get<T>(url, opts?)GET, parsed as JSON. Returns T.
post<T>(url, body, opts?)POST with JSON body, parsed response.
put<T>(url, body, opts?)PUT.
delete<T>(url, opts?)DELETE.

Examples

Fetch a customer profile

const customer = await f365.http.get<{ name: string; tier: string }>(
  `/api/customers/${f365.field('CustomerId').value}`
);
f365.field('CustomerName').value = customer.name;
f365.field('Tier').value = customer.tier;

Post-create webhook to a downstream system

f365.events.onSave(async ({ itemId }) => {
  await f365.http.post('/api/notify', {
    event: 'order.created',
    itemId,
    payload: f365.data(),
  });
});