How do I use the import & build IR API trigger?

What is and why should you use it?

This service allows you to call and trigger the IR platform to kick off a full source data import and master/partner feed build once your internal systems have completed their build replication to site etc. This is particularly useful when there is no fixed time that this completes each time and using set schedules can be difficult to manage meaning outward facing product data can be out of date as soon as its published.

 

What will you need from IR to get started

  1. Your Company GUID or multiple GUID's if you want to trigger builds for more then one merchant.
  2. User details for authentication. 

The technicalities of working with the Trigger Build API

Method: FeedBuild

HTTP Request: POST /api
Headers: Authorization
Parameters: CompanyId (GUID)
Pre-requisites: An authorisation token needs to be obtained from the authentication server beforehand.
Description: Queues a new full build for all the active feeds of the company set in the request. The build consists of the following steps:
  • Import source feeds.
  • build the Master Feed
  • and then import the company itemsBuild all the active partner feeds and import the feed items for each feed
Response:
HTTP 202 Accepted: A full build request has been queued and will be consumed as soon as possible.
HTTP 200 Success: A full build request has already been queued and waiting to be consumed.
HTTP 404 Not Found: A JSON error message is returned, see the troubleshooting section below.
HTTP 500 Internal Server Error, see the troubleshooting section below.
 
HTTP Examples:
Download this file with these examples to make it easier to set things up. API Builld Trigger Examples.txt
 
(Pre-requisite) Authentication request:
 
(Pre-requisite) Authentication response:
 
Build request:
A successful response:
 
Alternatively an error response would look like this:
 
Example with PowerShell:
 
Example with curl:
Using curl on Windows the authorisation token can be obtained like this:
 
Make sure the credentials in the header appear in the correct format email.address:password and that they have been encoded to base64, for example for a merchant whose login user name is foo@hostname.com and the password is bar the credentials should be passed as foo@hostname.com:bar encoded to base64 like this:
 
Authorization: Basic Zm9vQGhvc3RuYW1lLmNvbTpiYXI=
 
The full build can be queued like this:
 
On *nix shells the same command can be used with small alterations as using single quotes etc.
 
Troubleshooting:
If HTTP 404 Not Found is returned then there will be an error message in the response:
 
1. Company not found:
  • Make sure there are no typos in the CompanyId GUID, it should look like this: 113BEA24-1521-3BB7-A11B-A1B1911A6F2D
  • Make sure the company hasn’t been deleted.
2. User not found:
  • The authentication token has been obtained for a user that in the meantime has been deleted, try with another user.
3. User not linked to company:
  • Make sure the authentication token has been obtained for a user associated to the company the feeds need to be built for.
  • Merchants with multiple accounts for different countries are usually provisioned with one user linked to all the accounts, try to authenticate with that user instead.
If HTTP 500 Internal Server Error is returned:
1. If it’s returned by https://ms-user.intelligentreach.com/api/Authentication: Make sure the request contains Authorization header and the value starts with Basic
 
2. If it’s returned by https://ms-feedbuilder.intelligentreach.com/api/FeedBuild: Make sure the request contains the Authorization header and the value starts with Bearer