JavaScript APIs¶
This guide provides an overview of JavaScript APIs essential for building core storefront functionalities. These APIs serve as reliable tools to ensure stability and efficiency in your custom implementations.
Why you should use JavaScript APIs?¶
JavaScript APIs act as stable contracts between our platform and your code. Regardless of internal implementation, these APIs are designed to ensure backward compatibility, allowing your code to function seamlessly and return the expected results without needing adjustments.
Returning an API¶
You can access each API either synchronously or asynchronously:
- Synchronous Access: Returns the API object immediately.
- Asynchronous Access: Returns a Promise that resolves to the specified API.
useStorefront((storefront) => {
const httpRequesterApi = storefront.getApiSync('HTTPRequesterApi'); // synchronous
const httpRequesterApiAsync = storefront.getApi('HTTPRequesterApi'); // asynchronous
});
Remember to use either an async/await
or a then
when accessing an API asynchronously to ensure a seamless implementation
Objects¶
Some custom objects are frequently used across multiple APIs. We have gathered all general-purpose objects in this directory to streamline your reference experience.
Available APIs¶
- Authentication API
- Availability Notifier API
- Basket Additional Fields API
- Basket Addresses API
- Blog Article Comment Form API
- Contact Form API
- Customer Privacy API
- Favourites API
- Feature System API
- Flash Messenger API
- Http Requester API
- Newsletter Form API
- Page Manager API
- Product Ask Questions API
- Product Fetcher API
- Rate And Review API
- Recaptcha API
- Resolution Detector API
- Search API
- Storefront Settings API
- Translations API
- User API