Appearance
Backend API
INFO
The use of the backend API is not recommended. Consider using the Programmatic API first.
The base API URL is https://api.fibbl.com
Endpoints
/check-model-availability
Can be used to check whether a model is available or not. The components do this check and hide themselves, if the model isn't available (no model for a certain product id), so in most cases you don't have to check model availability manually.
- method
GET(HEADisn't supported) - query params:
product-id- the same id that is passed asdata-product-idto the componentsaccess-token- the token that can be found on the Fibbl Client Portal (the same token that can be used in the global component config for local development); on the backend the token is always required (both in dev and prod)
- Return statuses and values:
200with an empty body, if the model is available400with an empty body, if the model is not available4**or5**with an error message (plain text) in case of error
- Node.js example:
js
const apiUrl = 'https://api.fibbl.com/check-model-availability';
const response = await fetch(`${apiUrl}?product-id=123&access-token=xxxxxx`);
if (response.status === 200) {
console.info('Model is available');
} else {
const errorMessage = await response.text(); // read body as text
console.error(
`Model is not available. Status: ${response.status}. Message: ${errorMessage}`,
);
}/get-model-file-urls-for-ar
Returns file URLs that can be used to start AR manually. This endpoint is to be used on a backend that returns data to mobile apps.
The return type is:
ts
// URLs are valid only within 24 hours
interface ModelFileUrlsForAR {
glb: string;
usdz: string;
}
// null is returned, if the AR feature is disabled for the model
// (it can be disabled on the Client Portal)
type ReturnType = ModelFileUrlsForAR | null;The URLs are valid only within 24 hours. Do NOT cache them. It's recommended to request the URLs every time the product page is rendered.
- method
GET(HEADisn't supported) - query params:
product-id- the same id that is passed asdata-product-idto the componentsaccess-token- the token that can be found on the Fibbl Client Portal (the same token that can be used in the global component config for local development); on the backend the token is always required (both in dev and prod)
- Return statuses and values:
200with a JSON value: either an object ornull.400,404,403,500with a plain text message.
- Node.js example:
js
const apiUrl = 'https://api.fibbl.com/get-model-file-urls-for-ar';
const response = await fetch(`${apiUrl}?product-id=123&access-token=xxxxxx`);
if (response.status === 200) {
console.info('Data', await response.json());
} else {
const errorMessage = await response.text(); // read body as text
console.error(
`Error. Status: ${response.status}. Message: ${errorMessage}`,
);
}