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 have read-only or write access.
- read-only credentials are limited to HTTP GET operations, and write credentials will allow you to call data integration endpoints to import data and check import status.
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
Any applications using this PIM API codebase must support at least one of the following
- .NET Standard 2.0 (includes cross platform support with .NET Core)
- .NET Framework 4.6.1 (Windows only)
- Postman
- 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.
The following PIM entities are available in this API:
- Assets
- CategoryTree
- Product OData Open Type
- Property
- PropertyGroup
- Template
- Website
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.
// 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))';