Api
This article provides reference material about the Api
.
The Api
provides information about application API available for addons and contains the following functionalities:
GraphApi
The api.graphApi
provides the possibility to make a request to the stable Sana Commerce Cloud API. This function has the following arguments:
Argument | Type | Description |
---|---|---|
query | string | GraphQL query. |
variables | unknown | (optional) An object with all required query arguments. |
options | GraphApiOptions | (optional) The graph api options. |
The GraphApiOptions
type contains following properties:
Property | Type | Description |
---|---|---|
files | FileList | (optional) The list of Files |
retries | number | (optional) The number of retries of the request if it transiently fails. Default value of this property is 3. |
Fetch
The api.fetch
is more generic, as it provides the possibility to make a request to any URL. This function has the following arguments:
Argument | Type | Description | |
---|---|---|---|
url | string | The URL of the resource. | |
options | RequestInit | (optional) The request options. |