Update MyOxford categories using MyOxford API
Following is an example of using MyOxford API to update MyOxford categories. This example is not limited to tools used and can be replicated in similar programming languages.
1) Compile the list of category codes to input by using Excel. In this case, the Excel cells were concatenated together and some of the cells had calculation functions in it.
2) Once the list if compiled in .csv - it can be loaded to python as python dataframe
3) Below is Python code template that can be used to send requests to API
Following adjustments have to be made to the template:
- API key has to be added in Authorization part of Header
- List of category codes has to be loaded to categories_codes variable.
- List of country names has to be loaded to countries_names variable in the same order as applicable category codes are listed in variable categories_codes.
- List of categories names has to be loaded to categories_names variable in the same order as applicable category codes are listed in variable categories_codes. The example of category name is PoliticalAnalysis-PoliticalBriefing-ElSalvador
- parentId has to be specified in the payload. Usually, it stays constant for particular MyOxford section. The example of parentId is displayed on screenshot
4) Once the template is adjusted, run the cells of the code. It will take some time for code to run, depending on number of requests needed to be sent to API.