vyan024 / pim-api

API and console demo for Optimizely PIM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PIM Samples

Getting Started

To use the PIM API samples in this project, credentials (AppKey and AppSecret) must first be obtained by contacting Optimizely support at support@optmizely.com.

IMPORTANT Credentials provided will be readonly and limited to Http GET operations!

Once credentials have been obtained, create a document in the solution root folder called ConnectionInformation.json from the following sample code

{
  "AppKey": "Enter the App Key",
  "AppSecret": "Enter the App Secret"
}

Then simply start the console application to run the example test queries by entering their query number or name using Visual Studio or the .NET cli command in the checkout out code folder

dotnet run

Requirements

Any applications using this PIM API codebase must support at least one of the following

Important Notes

  • API uses OData
  • Queryies that specify a $top will never include a next link.
  • Queries that do not specify $top will return at most 1,000 results. If more are available a next link will be provided for pagination in the response.
  • The console application does not demonstrate iterating a full product set, but sample code is available in the EntityIteratorTests.cs class in the test project.
  • JSON Serialization can be done with either Newtonsoft.Json or System.Text.Json implemented using a custom IJsonSerializer interface in the Pim API Project.

Entities

The following PIM entities are available in this API:

  • Assets
  • CategoryTree
  • Product OData Open Type
  • Property
  • PropertyGroup
  • Template
  • Website

Serializers

Both Newtonsoft.Json and System.Text.Json are supported. Basic serialization and deserialization is available in the PimApi.Serialization namespace. Entities do not utilize any special attributes that each serializer provides to allow for choice. If a different serializer is desired an IJsonSerializer interface is provided for customization, but will not be supported.

Known Issues

 // example of request with nested $expand that should work but does not
 // the workaround is to not use nested $expands and do a second request to get extra data
 var shouldWorkButFails = '/products?$expand=categorytrees($expand=categorytree($select=name,id))';

Useful Resources

About

API and console demo for Optimizely PIM

License:Apache License 2.0


Languages

Language:C# 100.0%