Skip to main content
e-CROSS APIs use token-based pagination to handle large datasets. This means that instead of returning all results in a single response, the API returns a token that can be used to retrieve the next page of results. To use pagination, you need to make your first request without the nextPageToken query parameter. If the response includes a nextPageToken attribute, use it in the nextPageToken query parameter for the next request. Repeat until no nextPageToken is returned. Example of how to use pagination:
# First page
curl -X GET 'https://product.api.e-cross.tech/ext/merchant/skus' \
  -H "Authorization: Bearer ${YOUR_TOKEN}"

# Next page (using token from previous response)

curl -X GET "https://product.api.e-cross.tech/ext/merchant/skus?nextPageToken=${TOKEN_FROM_PREVIOUS_RESPONSE}" \
 -H "Authorization: Bearer ${YOUR_TOKEN}"

async function getAllSKUs(token) {
  let allSKUs = [];
  let nextPageToken = null;

  do {
    const url = nextPageToken
      ? `https://product.api.e-cross.tech/ext/merchant/skus?nextPageToken=${nextPageToken}`
      : 'https://product.api.e-cross.tech/ext/merchant/skus';

    const response = await fetch(url, {
      headers: { 'Authorization': `Bearer ${token}` }
    });

    const data = await response.json();
    allSKUs = allSKUs.concat(data.skus);
    nextPageToken = data.nextPageToken;
  } while (nextPageToken);

  return allSKUs;
}
import requests

def get_all_skus(token):
    all_skus = []
    next_page_token = None

    while True:
        url = 'https://product.api.e-cross.tech/ext/merchant/skus'
        params = {}
        if next_page_token:
            params['nextPageToken'] = next_page_token

        response = requests.get(
            url,
            headers={'Authorization': f'Bearer {token}'},
            params=params
        )

        data = response.json()
        all_skus.extend(data['skus'])

        next_page_token = data.get('nextPageToken')
        if not next_page_token:
            break

    return all_skus