api.apiGet<T>(endpoint) Convenience method that sends a GET request to the public REST API and returns the parsed JSON body. Throws if the response is not 2xx.
| argument | Type | Description |
|---|---|---|
| endpointrequired | string | API path starting with /api/v1/... (e.g. /api/v1/cards/123). See the REST section for the full list of endpoints. |
Return value - Promise<T>
const api = window.Addon.iframe();
const currentUser = await api.apiGet('/api/v1/users/current');
// { id, email, full_name, avatar_url, ... }
const spaces = await api.apiGet('/api/v1/spaces');
// [{ id, title, ... }, ...]