Storefront
By using this API, you can get information about the storefronts and you can save and embed javascript script in your storefront theme, so script run it easily in your theme.
Overview
The storefront API stores information about a store's storefront such as name, javascript script information.
Models
Storefront
type Storefront {
id: ID!
name: String!
}
Fields
The storefront's name.
Storefront Javascript Script
type StorefrontJSScript {
id: ID!
authorizedAppId: String
contentType: StorefrontJSScriptContentTypeEnum
fileName: String
isActive: Boolean!
isHighPriority: Boolean
name: String!
order: Float
scriptContent: String!
storeAppId: String
storefrontId: String!
}
Fields
authorizedAppId
StringThe id of the logged in application.
contentType
StorefrontJSScriptContentTypeEnumThe type of javascript script content.
fileName
StringThe type of javascript script content.
Shows the availability status of the storefront.
isHighPriority
BooleanIndicates if the script has a high priority and should be executed before others.
The storefront javascript script's name.
order
FloatThe order of the script to be executed.
The storefront javascript script's content.
storeAppId
StringThe store app's id.
The storefront's id.
Queries
List Storefronts
listStorefront(
id: StringFilterInput
): [Storefront!]!
Arguments
Return Type
Storefront
StorefrontList Storefront JS Scripts
Use this query to list storefront javascript scripts by supplying the storefrontId
input.
listStorefrontJSScript(
storefrontId: String
): [StorefrontJSScript!]!
Arguments
storefrontId
StringReturn Type
StorefrontJSScript
StorefrontJSScriptMutations
Save Storefont JS Script
Using this api, you can save javascript script to a the storefront.
saveStorefrontJSScript(
input: StorefrontJSScriptInput!
): StorefrontJSScript!
Arguments
Return Type
StorefrontJSScript
StorefrontJSScriptDelete Storefont JS Script
Using this api, you can delete javascript script from a the storefront.
deleteStorefrontJSScript(
storefrontIdList: [String!]!
): Boolean!
Arguments
Return Type
Boolean
BooleanThe Boolean
scalar type represents true
or false
.
Examples
Retrieves a list of storefronts
- BASH
- NODE.JS
curl --location --request POST 'https://api.myikas.com/api/v1/admin/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your_access_token>' \
--data-raw '{"query":"{ listStorefront(id: { eq: \"storefront_id\" }) { id name } } "}'
const axios = require('axios');
const data = {"query":`{
listStorefront(id: { eq: "storefront_id" }) {
id
name
}
}
`};
const config = {
method: 'POST',
url: 'https://api.myikas.com/api/v1/admin/graphql',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer your_token'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
if (error.response) {
console.log(JSON.stringify(error.response.data));
}
});
Response
{
"data": {
"listStorefront": [
{
"id": "78c58c28-d191-4ab1-a8df-4b23283a7fb4",
"name": "Storefront's Name"
}
]
}
}
Retrieves a list of storefront javascript scripts
- BASH
- NODE.JS
curl --location --request POST 'https://api.myikas.com/api/v1/admin/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your_access_token>' \
--data-raw '{"query":"{ listStorefrontJSScript(storefrontId: \"storefront_id\") { id name storefrontId isActive storeAppId authorizedAppId scriptContent } } "}'
const axios = require('axios');
const data = {"query":`{
listStorefrontJSScript(storefrontId: "storefront_id") {
id
name
storefrontId
isActive
storeAppId
authorizedAppId
scriptContent
}
}
`};
const config = {
method: 'POST',
url: 'https://api.myikas.com/api/v1/admin/graphql',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer your_token'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
if (error.response) {
console.log(JSON.stringify(error.response.data));
}
});
Response
{
"data": {
"listStorefrontJSScript": [
{
"id": "18c58c28-d191-4ab1-a8df-4b23283a7fb4",
"name": "Storefront Javascript Script's Name",
"storefrontId": "78c58c28-d191-4ab1-a8df-4b23283a7fb4",
"isActive": true,
"storeAppId": "28c58c28-d191-4ab1-a8df-4b23283a7fb5",
"authorizedAppId": "58c58c28-d191-4ab1-a8df-4b23283a7fb9",
"scriptContent": "<script src='https://www.ikas.com'>Welcome to ikas</script>"
}
]
}
}
Save Storefont JS Script
- BASH
- NODE.JS
curl --location --request POST 'https://api.myikas.com/api/v1/admin/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your_access_token>' \
--data-raw '{"query":"mutation { saveStorefrontJSScript( input: { name: \"ikas Javascript Script\" storefrontId: \"78c58c28-d191-4ab1-a8df-4b23283a7fb4\" scriptContent: \"<script src='https://www.ikas.com'>Welcome to ikas</script>\" } ) { id name storefrontId isActive storeAppId authorizedAppId scriptContent } } "}'
const axios = require('axios');
const data = {"query":`mutation {
saveStorefrontJSScript(
input: {
name: "ikas Javascript Script"
storefrontId: "78c58c28-d191-4ab1-a8df-4b23283a7fb4"
scriptContent: "<script src='https://www.ikas.com'>Welcome to ikas</script>"
}
) {
id
name
storefrontId
isActive
storeAppId
authorizedAppId
scriptContent
}
}
`};
const config = {
method: 'POST',
url: 'https://api.myikas.com/api/v1/admin/graphql',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer your_token'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
if (error.response) {
console.log(JSON.stringify(error.response.data));
}
});
Response
{
"data": {
"saveStorefrontJSScript": {
"id": "18c58c28-d191-4ab1-a8df-4b23283a7fb4",
"name": "Storefront Javascript Script's Name",
"storefrontId": "78c58c28-d191-4ab1-a8df-4b23283a7fb4",
"isActive": true,
"storeAppId": "28c58c28-d191-4ab1-a8df-4b23283a7fb5",
"authorizedAppId": "58c58c28-d191-4ab1-a8df-4b23283a7fb9",
"scriptContent": "<script src='https://www.ikas.com'>Welcome to ikas</script>"
}
}
}
Delete Storefont JS Script
- BASH
- NODE.JS
curl --location --request POST 'https://api.myikas.com/api/v1/admin/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your_access_token>' \
--data-raw '{"query":"mutation { deleteStorefrontJSScript( storefrontIdList: [\"18c58c28-d191-4ab1-a8df-4b23283a7fb4\"] ) } "}'
const axios = require('axios');
const data = {"query":`mutation {
deleteStorefrontJSScript(
storefrontIdList: ["18c58c28-d191-4ab1-a8df-4b23283a7fb4"]
)
}
`};
const config = {
method: 'POST',
url: 'https://api.myikas.com/api/v1/admin/graphql',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer your_token'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
if (error.response) {
console.log(JSON.stringify(error.response.data));
}
});
Response
{
"data": {
"deleteStorefrontJSScript": true
}
}