APIs

Limitations

There are some limitations of the  Categorization API that you have to be aware of. The following apply:

  • Number of requests per second: 10

  • Number of requests per day: 50000

If any of these limitations are overriden you will get the folloing response: HTTP 429 Too Many Requests

Recomentations

Be sure to cache the responses when getting categories (and attributes). The Api does not offer any kind of filtering or query endpoints. It is better if you, at your end, filter e.g. categories depending on your needs. Once all the data is fetched these filtering/query methods should be fast and is not dependant on calls to and endpoint.

Working with the data

The Categorization Api can be used when you are calling the e.g. product endpoint in CDONs Import Api. In the XML sent to this enpoint there is a section where you can specify a Category and its Attributes. 

Looking at the Import Api i.e. the Product endpoint, when applying the category, this part of the XML could look like this (note that this is the 4.9 version of the Api):

        <category>

            <google>292</google>

            <attributes>

                <clock_frequency_ghz>3.6</clock_frequency_ghz>

                <cpu_cores_no>6</cpu_cores_no>

            </attributes>

        </category>

 Or

         <category>

            <cdon>computer_components_cpu_processors</cdon>

            <attributes>

                <clock_frequency_ghz>3.6</clock_frequency_ghz>

                <cpu_cores_no>6</cpu_cores_no>

            </attributes>

        </category>

 This part of the XML should be your guide when looking into what wo need from the Categorization Api. With the regards of the XML example above we can investigate the responses from the Categorization Api. Relevant data is in yellow.

The Categorization Api

The Google endpoint returns this (https://cdonexternalapi-prod-apim.azure-api.net/categorization/api/v1/categories/google):

[…

    {

        "googleProductCategoryId": 292,

        "title": "Computer Processors",

        "treePath": "|Electronics|Electronics Accessories|Computer Components|Computer Processors|",

        "children": null,

        "parentTreePath": "|Electronics|Electronics Accessories|Computer Components|",

        "treeLevel": 4,

        "isMainGoogleCategory": true,

        "mainCategoryId": 4887

    },

…]

The Categories endpoint returns this (https://cdonexternalapi-prod-apim.azure-api.net/categorization/api/v1/categories):

[…

  {

        "id": 4887,

        "externalKey": "computer_components_cpu_processors",

        "title": "CPU (Processors)",

        "parentId": 4885,

        "treePath": [

            2008,

            4853,

            4885,

            4887

        ],

        "root": {

            "categoryId": 2008,

            "externalKey": "home_electronics",

            "title": "Home Electronics (document)"

        },

        "description": "CPU (Processors)",

        "isLeaf": true,

        "metaId": 533687,

        "treeLevel": 3,

        "rootId": 2008,

        "googleProductCategoryId": 292,

        "isMainGoogleCategory": true

    },

…]

For the categories above the following attributes are listed (https://cdonexternalapi-prod-apim.azure-api.net/categorization/api/v1/categories/4887/attributes):

[…

    {

        "metaId": 534127,

        "name": "Clock Frequency",

        "externalKey": "clock_frequency_ghz",

        "isSystemAttribute": false,

        "unitId": 689,

        "unitName": "gigaherz",

        "description": null,

        "dataType": "",

        "isRequired": false,

        "enumMetaId": null

    },

    {

        "metaId": 534128,

        "name": "CPU Cores",

        "externalKey": "cpu_cores_no",

        "isSystemAttribute": false,

        "unitId": 711,

        "unitName": "numberOf",

        "description": null,

        "dataType": "int",

        "isRequired": false,

        "enumMetaId": null

    },

…]

This is what you need in order to do Categorization for the import.

Regarding isMainGoogleCategory:

Each CDON category is connected to a Google category. There are some misalignments in the mapping between the two (CDON and Google). At some points we have more than on CDON category pointing at ONE Google category. One of these CDON categories should be the on to map. This is marked by IsMainGoogleCategory = true.