NAV
cURL PHP - cURL JavaScript - Fetch

Overview

The GearGag API is organized around REST. Our API accepts JSON request payload and returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

Authentication

The API uses Access Token to authenticate requests. Authentication to the API is performed via Token. Your Access Token carry many privileges, so be sure to keep them secure! Do not share your secret Access Token in publicly accessible areas such as GitHub, client-side code, and so forth. If you are currently logged in account settings, you can go to [Stores Access Token] and get API token there.

To authorize, use this code:

curl --location --request POST 'URL_PLACE_HERE' \
--header 'Authorization: REPLACE_YOUR_TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data-raw '{DATA_HERE}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'URL_PLACE_HERE',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST/GET',
  CURLOPT_POSTFIELDS =>'{DATA_HERE}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: REPLACE_YOUR_TOKEN_HERE',
    'Content-Type: application/json',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
// TODO Something
var myHeaders = new Headers();
myHeaders.append("Authorization", "REPLACE_YOUR_TOKEN_HERE");

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: '_DATA_HERE_'
  redirect: 'follow'
};

fetch("URL_PLACE_HERE", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Make sure to replace REPLACE_YOUR_TOKEN_HERE with your API key.

GearGag uses API token to allow access to the API. You can get a new API token at Stores Access Token.

GearGag expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: REPLACE_YOUR_TOKEN_HERE

Product

Search dimension by Sku

curl --location --request GET 'https://api.geargag.com/integrate/product/dimensions.json?sku=123456' \
--header 'Authorization: REPLACE_YOUR_TOKEN_HERE'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.geargag.com/integrate/product/dimensions.json?sku=123456',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: REPLACE_YOUR_TOKEN_HERE'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var myHeaders = new Headers();
myHeaders.append("Authorization", "REPLACE_YOUR_TOKEN_HERE");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.geargag.com/integrate/product/dimensions.json?sku=123456", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
  "status": true,
  "data": [
    {
      "id": "5346",
      "name": "Front",
      "id_catalog": "128",
      "dimensions": [
        "4500x5400",
        "2400x3000",
        "2100x2400",
        "2400x3200",
        "2800x3200",
        "4200x4800"
      ]
    }
  ]
}

Returns formatted dimensions GearGag supports by sku.

HTTP Request

GET https://api.geargag.com/integrate/product/dimensions.json

Request (params):

Name Required Type Description
sku Yes String The Sku of product
     

Response (json):

Name Type Description
status String true/false
message String
data jsonArray

data: The data is an array of

Name Type Description
id Integer The Item ID
name String The Item name, ex: "Front"
id_catalog Integer The category ID of item
dimensions stringArray a list dimensions ex: ["4500x5400", "2400x3000"]
   

Get all sku of supported catalog

curl --location --request GET 'https://api.geargag.com/integrate/product/catalogs.json' \
--header 'Authorization: REPLACE_YOUR_TOKEN_HERE'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.geargag.com/integrate/product/catalogs.json',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: REPLACE_YOUR_TOKEN_HERE',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

var myHeaders = new Headers();
myHeaders.append("Authorization", "REPLACE_YOUR_TOKEN_HERE");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.geargag.com/integrate/product/catalogs.json", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "status": true,
    "data": [
        {
            "id": "128",
            "name": "Guys Tee",
            "sku": "GUYSTEE-BLACK-L-FRONT",
            "category": "Apparel",
            "attributes": {
                "Color": "Black",
                "Size": "L",
                "Side": "Front"
            }
        },
        {
            "id": "129",
            "name": "Guys Tee",
            "sku": "GUYSTEE-BLACK-M-FRONT",
            "category": "Apparel",
            "attributes": {
                "Color": "Black",
                "Size": "M",
                "Side": "Front"
            }
        },
        {
            "id": "130",
            "name": "Guys Tee",
            "sku": "GUYSTEE-BLACK-S-FRONT",
            "category": "Apparel",
            "attributes": {
                "Color": "Black",
                "Size": "S",
                "Side": "Front"
            }
        }
    ]
}

Returns all sku of supported catalog.

HTTP Request

GET https://api.geargag.com/integrate/product/catalogs.json

Request:

Not required

Response (json):

Name Type Description
status String true/false
message String
data jsonArray

data: The data is an array of

Name Type Description
id Integer Item's ID
name String Item's name
sku String Item's SKU
category String The category of item
attributes object Item's attributes
   

attributes

Name Type Description
Color String Item's color
Size String Item's size
Side String Item's side (Front/Back)
   

Order

Create an Order

curl --location --request POST 'https://api.geargag.com/integrate/order.json' \
--header 'Authorization: REPLACE_YOUR_TOKEN_HERE' \
--header 'Content-Type: application/json' \
--data-raw '{
    "order_id": "AM-123",
    "shipping_info": {
        "full_name": "John",
        "address_1": "Jennifer",
        "address_2": "",
        "city": "California",
        "state": "CA",
        "postcode": "12345",
        "country": "US",
        "email": "[email protected]",
        "phone": "0123456789"
    },
    "items": [
        {
            "name": "Example product",
            "sku_external": "Geargag example",
            "sku": "GUYSTEE-BLACK-L-0",
            "quantity": 1,
            "price": 22.99,
            "currency": "USD",
            "import_mockup_1": "https://example.com/Unisex-black-front.jpg",
            "import_mockup_2": "",
            "import_mockup_3": "",
            "dimensions": [
                {
                    "name": "Front",
                    "image_code": "5F6AE6C167E48"
                },
                {
                    "name": "Back",
                    "image_code": "5F6AE6C167E48"
                }
            ]
        }
    ]
}'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.geargag.com/integrate/order.json',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "order_id": "AM-123",
    "shipping_info": {
        "full_name": "John",
        "address_1": "Jennifer",
        "address_2": "",
        "city": "California",
        "state": "CA",
        "postcode": "12345",
        "country": "US",
        "email": "[email protected]",
        "phone": "0123456789"
    },
    "items": [
        {
            "name": "Example product",
            "sku_external": "Geargag example",
            "sku": "GUYSTEE-BLACK-L-0",
            "quantity": 1,
            "price": 22.99,
            "currency": "USD",
            "import_mockup_1": "https://example.com/Unisex-black-front.jpg",
            "import_mockup_2": "",
            "import_mockup_3": "",
            "dimensions": [
                {
                    "name": "Front",
                    "image_code": "5F6AE6C167E48"
                },
                {
                    "name": "Back",
                    "image_code": "5F6AE6C167E48"
                }
            ]
        }
    ]
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: REPLACE_YOUR_TOKEN_HERE',
    'Content-Type: application/json',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

var myHeaders = new Headers();
myHeaders.append("Authorization", "REPLACE_YOUR_TOKEN_HERE");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({"order_id":"AM-123","shipping_info":{"full_name":"John","address_1":"Jennifer","address_2":"","city":"California","state":"CA","postcode":"12345","country":"US","email":"[email protected]","phone":"0123456789"},"items":[{"name":"Example product","sku_external":"Geargag example","sku":"GUYSTEE-BLACK-L-0","quantity":1,"price":22.99,"currency":"USD","import_mockup_1":"https://shark.nyc3.digitaloceanspaces.com/2020/5/8/1585018074858-0814234699-Unisex-black-front.jpg","import_mockup_2":"","import_mockup_3":"","dimensions":[{"name":"Front","image_code":"5F6AE6C167E48"},{"name":"Back","image_code":"5F6AE6C167E48"}]}]});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.geargag.com/integrate/order.json", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "status": true,
    "message": "Order has been created",
    "data": {
        "order_id": 666666
    }
}

You can use Geargag Order API to import orders to your Geargag store and request fulfillment for these orders.

HTTP Request

POST https://api.geargag.com/integrate/order.json

Request (json):

Name Required Type Description
order_id Yes String The Order number in your system. Use this order number to retrieve tracking number subsequently.
shipping_info Yes Object Shipping address of the order.
items Yes String An array of product items.
     

shipping_info

Name Required Type Description
full_name Yes String The customer name.
address_1 Yes String The customer address.
address_2 No String The customer address 2.
city No String The city name.
state Yes String The state code.
postcode No String The PostCode.
country Yes String The country code.
email No String The customer email.
phone Yes String The customer phone.
     

items: The items is an array of

Name Required Type Description
name Yes String Title of product item.
sku Yes String The SKU of product item.
price Yes String Price of product item. Use this value to take advance of Geargag statistics feature.
currency Yes String The currency of product item price.
quantity Yes Integer The number of product items.
dimensions Yes Object The detailed dimensions of product item.
import_mockup_1 No URL (Link url of mockup 1)
import_mockup_2 No URL (Link url of mockup 2)
import_mockup_3 No URL (Link url of mockup 3)
     

dimensions: The dimensions is an array of

Name Required Type Description
name Yes String Applicable for some special products. For example, possible values: "Front" or "Back".
image_code Yes String The Image code.
     

Response (json):

Name Type Description
status String true/false
message String
data jsonObject

data

Name Type Description
order_id Integer The ID of created GearGag order
     

Get Order Tracking

curl --location --request GET 'https://api.geargag.com/integrate/order/tracking.json?order_id=AM-123&type=2' \
--header 'Authorization: REPLACE_YOUR_TOKEN_HERE' \
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.geargag.com/integrate/order/tracking.json?order_id=AM-123&type=2',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: REPLACE_YOUR_TOKEN_HERE',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

var myHeaders = new Headers();
myHeaders.append("Authorization", "REPLACE_YOUR_TOKEN_HERE");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.geargag.com/integrate/order/tracking.json?order_id=AM-123&type=2", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "status": true,
    "message": "Success",
    "data": {
      "order_id": 666666,
      "order_id_import": "AM-123",
      "tracking_code": "123456789",
      "sku": "123456",
      "name": "xxxx"
    }
}

You can get order tracking after order was fulfilled by order_id. Where order_id is created by GearGag or imported manual by customer.

HTTP Request

GET https://api.geargag.com/integrate/order/tracking.json

Request Params:

Name Required Type Description
order_id Yes Integer GearGag OrderID or imported OrderID
type No Integer If type IS NULL or type = 1 then order_id exists on the system. If type = 2 then order_id that imported manual by customer
     

Response (json):

Name Type Description
status String true/false
message String
data jsonObject

data

Name Type Description
order_id Integer The ID of order
order_id_import Integer The ID of imported order
tracking_code String The code of tracking
sku Integer The SKU of product
name Integer The name of product
     

Get Order fulfillment status

curl --location --request GET 'https://api.geargag.com/integrate/order/fulfillment.json?order_id=AM-123&type=2' \
--header 'Authorization: REPLACE_YOUR_TOKEN_HERE' \
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.geargag.com/integrate/order/fulfillment.json?order_id=AM-123&type=2',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: REPLACE_YOUR_TOKEN_HERE',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

var myHeaders = new Headers();
myHeaders.append("Authorization", "REPLACE_YOUR_TOKEN_HERE");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.geargag.com/integrate/order/fulfillment.json?order_id=AM-123&type=2", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "status": true,
    "message": "Success",
    "data": {
      "order_id": "666666",
      "order_id_import": null,
      "total": "0.00",
      "total_payment": "0.00",
      "shipping_price": "0.00",
      "currency": "USD",
      "presentment_currency": "USD",
      "fulfillment_status": "unfulfilled",
      "subtotal_price": null,
      "total_product_price": null
    }
}

You can get order status after order was created by order_id. Where order_id is created by GearGag or imported manual by customer.

HTTP Request

GET https://api.geargag.com/integrate/order/fulfillment.json

Request Params:

Name Required Type Description
order_id Yes Integer GearGag OrderID or imported OrderID
type No Integer If type IS NULL or type = 1 then order_id exists on the system. If type = 2 then order_id that imported manual by customer
     

Response (json):

Name Type Description
status String true/false
message String
data jsonObject

data

Name Type Description
order_id Integer The GearGag Order ID
order_id_import String The External ID
fulfillment_status String The status of order (unfulfilled, fulfilled, in_progress, partial, requested, pending, issues)
total Decimal The total of order
total_payment Decimal The total_payment of order
shipping_price Decimal The shipping_price of order
currency String The currency of order
presentment_currency String The presentment_currency of order
subtotal_price Decimal The subtotal_price of order
total_product_price Decimal The total_product_price of order
     

Resources

Upload file to library

curl --location --request POST 'https://api.geargag.com/integrate/library/image.json?code=TT123456' \
--header 'Authorization: REPLACE_YOUR_TOKEN_HERE' \
--form 'file=@"./GearGag/capture.png"'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.geargag.com/integrate/library/image.json?code=TT123456',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('file'=> new CURLFILE('./GearGag/capture.png')),
  CURLOPT_HTTPHEADER => array(
    'Authorization: REPLACE_YOUR_TOKEN_HERE',
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

var myHeaders = new Headers();
myHeaders.append("Authorization", "REPLACE_YOUR_TOKEN_HERE");

var formdata = new FormData();
formdata.append("file", fileInput.files[0], "./GearGag/capture.png");

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: formdata,
  redirect: 'follow'
};

fetch("https://api.geargag.com/integrate/library/image.json?code=TT123456", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "status": true,
    "message": "Success",
    "data": {
        "id_shop": 666666,
        "type": "artwork",
        "name": "capture.png",
        "code": "TT123456",
        "tag": "",
        "mime_type": "image/png",
        "hash": "",
        "cdn": "a7",
        "size": 1442,
        "file": "https://example.com/Unisex-black-front.jpg",
        "note": "File is an image - image/png.",
        "width": 263,
        "height": 151,
        "created_at": "2020-12-09 01:56:45",
        "file_thumb": "https://example.com/Unisex-black-front.jpg"
    }
}

Geargag support file format extension ['gif', 'png', 'jpg', 'jpeg', 'svg', 'ttf', 'ai'].

HTTP Request

POST https://api.geargag.com/integrate/library/image.json?code=YOUR_CODE_HERE

Request (params):

Name Required Type Description
code Yes String Code image of library If code is null, code auto generate from name your file. Don't input special characters ('^£$%&()}{@#~?><>,

Request (form-data):

Name Required Type Description
file Yes File The File data.
     

Response (json):

Name Type Description
status String true/false
message String [Image has been uploaded]
data Object

data

Name Type Description
name String The name of image
code String The code of image
mime_type String The image mine type
size Integer The image size
note String The image note
width Integer The image with
height Integer The image height
created_at Date The created date
file URL The URL of image
file_thumb URL The URL of thumb image
data jsonObject

Search library by code image

curl --location --request GET 'https://api.geargag.com/integrate/library/images.json?code=TT123456' \
--header 'Authorization: REPLACE_YOUR_TOKEN_HERE'
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.geargag.com/integrate/library/images.json?code=TT123456',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: REPLACE_YOUR_TOKEN_HERE'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var myHeaders = new Headers();
myHeaders.append("Authorization", "REPLACE_YOUR_TOKEN_HERE");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.geargag.com/integrate/library/images.json?code=TT123456", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

The above command returns JSON structured like this:

{
    "status": true,
    "data": {
        "code": "xxxxx",
        "type": "artwork",
        "width": "263",
        "height": "151",
        "file": "/library/xxxxx/4387/origin/xxxxx_5fd09f5b79b1d.png",
    }
}

Returns an image's information from library by code.

HTTP Request

GET https://api.geargag.com/integrate/library/images.json

Request (params):

Name Required Type Description
code Yes String The Code of image
     

Response (json):

Name Type Description
status String true/false
message String
data Object

data

Name Type Description
code String The code of image
type String The type of image
width Integer The image with
height Integer The image height
file URL The URL of image
   

Errors

The GearGag API uses the following error codes:

HTTP Response status code

Status code Description
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API token is wrong.
422 Bad Request/ Unprocessable Entity - Your data is invalid
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.

Data Response status value

Status value Description
true Ok
false Not OK