Item List API

Overview

Endpoint: https://graph.cj.com/publishers

The Item List API is a GraphQL API providing publishers programmatic access to advertiser-defined item lists. This is especially useful when working with item list based Program Terms. While commission rates are not included in this dataset, combining item list data with the Program Terms API provides a more complete view of how specific products may influence earnings potential.


Query Usage

Queries that return sets of data use page token-based pagination. Results are split into pages that must be retrieved sequentially.

Initial Request

For your first request, include your query arguments and omit the page argument (or pass null). Use pageSize to specify how many records you want per page. Note that the API may return fewer records than the requested pageSize on any given page — count the records in the response to determine how many were returned.

query ItemList {
  itemList(itemListId: "qwe-123") {
    id
    name
    items(pageSize: 2) {
      nextPage
      records {
        name
        sku
      }
    }
  }
}

Response:

{
  "data": {
    "itemList": {
      "id": "qwe-123",
      "name": "Books",
      "items": {
        "nextPage": "dummy-page-token-1234",
        "records": [
          { "name": "The How To Book on the Zombie", "sku": "QWE-QWERT" },
          { "name": "How to Survive a Zombie Apocalypse", "sku": "QWE-RTY-123" }
        ]
      }
    }
  }
}

The response includes a nextPage token. If nextPage is null, you have reached the last page.

Subsequent Requests

Pass the nextPage token from the previous response as the page argument. All other query arguments must remain the same as the initial request.

query ItemList {
  itemList(itemListId: "qwe-123") {
    id
    name
    items(pageSize: 2, page: "dummy-page-token-1234") {
      nextPage
      records {
        name
        sku
      }
    }
  }
}

Response:

{
  "data": {
    "itemList": {
      "id": "qwe-123",
      "name": "Books",
      "items": {
        "nextPage": "dummy-page-token-for-third-page-123",
        "records": [
          { "name": "The Best Book on Zombies", "sku": "ASD-FGH-456" },
          { "name": "This is not a Zombie Book", "sku": "ZXC-VBN-789" }
        ]
      }
    }
  }
}

Continue querying with each nextPage token until the value is null, indicating you have retrieved all pages.


Error Codes

Errors are returned as a list in an errors field of the response. Each error contains a message field with a description, and an extensions.code field for programmatic identification.

CodeDescription
InternalErrorAn unexpected internal server error occurred. The request may be retryable.
InvalidArgumentsOne or more provided arguments are invalid.
NotFoundThe requested resource could not be found.
UnauthorizedAccess denied due to a missing or invalid authorization token.

Example error response:

{
  "errors": [
    {
      "message": "Internal Server Error",
      "locations": [{ "line": 2, "column": 3 }],
      "path": ["itemList"],
      "extensions": {
        "code": "InternalError",
        "classification": "INTERNAL_ERROR"
      }
    }
  ],
  "data": null,
  "extensions": {
    "requestId": "request-id-2cf7513cc919"
  }
}