Skip to main content

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

idID!required
nameString!required

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

idID!required
authorizedAppIdString

The id of the logged in application.

The type of javascript script content.

fileNameString

The type of javascript script content.

isActiveBoolean!required

Shows the availability status of the storefront.

isHighPriorityBoolean

Indicates if the script has a high priority and should be executed before others.

nameString!required

The storefront javascript script's name.

orderFloat

The order of the script to be executed.

scriptContentString!required

The storefront javascript script's content.

storeAppIdString

The store app's id.

storefrontIdString!required

The storefront's id.

Queries

List Storefronts

listStorefront(
id: StringFilterInput
): [Storefront!]!

Arguments

Return Type

StorefrontStorefront

List Storefront JS Scripts

Use this query to list storefront javascript scripts by supplying the storefrontId input.

listStorefrontJSScript(
storefrontId: String
): [StorefrontJSScript!]!

Arguments

storefrontIdString

Return Type

StorefrontJSScriptStorefrontJSScript

Mutations

Save Storefont JS Script

Using this api, you can save javascript script to a the storefront.

saveStorefrontJSScript(
input: StorefrontJSScriptInput!
): StorefrontJSScript!

Arguments

Return Type

StorefrontJSScriptStorefrontJSScript

Delete Storefont JS Script

Using this api, you can delete javascript script from a the storefront.

deleteStorefrontJSScript(
storefrontIdList: [String!]!
): Boolean!

Arguments

storefrontIdList[String!]!required

Return Type

BooleanBoolean

The Boolean scalar type represents true or false.

Examples

Retrieves a list of storefronts

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 } } "}'

Response

{
"data": {
"listStorefront": [
{
"id": "78c58c28-d191-4ab1-a8df-4b23283a7fb4",
"name": "Storefront's Name"
}
]
}
}

Retrieves a list of storefront javascript scripts

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 } } "}'

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

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 } } "}'

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

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\"] ) } "}'

Response

{
"data": {
"deleteStorefrontJSScript": true
}
}