PRICETRACK API

Interfacing with the PriceTrack REST & XML API


The PriceTrack REST & XML API enables developers to easily interact with the PriceTrack Web Services via third-party applications. Requests are made to the API using standard GET and POST commands and the API returns its results in XML or JSON depending on the Accept header you provide in your request (Accept: application/xml for XML requests, Accept: application/json for JSON requests). API returns XML response as default for any other Accept headers.

basic Examples


For the examples in this section we’re using the command line utility cURL. This should provide a good platform to familiarize yourself with the API before integrating it into your application using the programming language of your choice.

basic Authentication


The REST API uses token query string parameter over SSL for each request. To authenticate, simply accompany each request with your PriceTrack Token. You can find the API Key by browsing to the Company page from the Panel. If you don't have a PriceTrack Token, a free one can be created here.

basic Getting Your Account Information


This command uses a GET request to fetch information about your account.

JSON Request:

curl -i -H "Accept: application/json" -X GET https://api.pricetrack.eu/v1/account?token={YOUR_TOKEN}

XML Request:

curl -i -H "Accept: application/xml" -X GET https://api.pricetrack.eu/v1/account?token={YOUR_TOKEN}

Sample JSON Response:

{
   "Status": 200,
   "Message": "Operation successful",
   "Quote": {
      "Max": 20000,
      "Remaining": 19980
   },
   "Page": {
      "PageIndex": 0,
      "Pages": 1,
      "Records": 1,
      "HasMore": false
   },
   "Errors": null,
   "Data": {
      "Id": "91ac7f86-b786-49f0-b960-4c0957b74b87",
      "Name": "Demo Company",
      "Country": "United States",
      "Subscription": "Enterprise",
      "SubscriptionExpires": "2025-01-01T00:00:00+03:00",
      "Members": [
         {
            "Id": "3f878f0c-4408-4870-a370-b63b2adc6c01",
            "Firstname": "Demo",
            "Lastname": "User",
            "Email": "[email protected]",
            "Role": "Manager"
         }
      ]
   }
}

Sample XML Response:

<?xml version="1.0" encoding="UTF-8"?>
<ApiResponse xmlns="http://schemas.datacontract.org/2004/07/PriceTrack.Web.Api.Models" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
   <Data i:type="Company">
      <Country>United States</Country>
      <Id>91ac7f86-b786-49f0-b960-4c0957b74b87</Id>
      <Members>
         <Member>
            <Email>[email protected]</Email>
            <Firstname>Demo</Firstname>
            <Id>3f878f0c-4408-4870-a370-b63b2adc6c01</Id>
            <Lastname>User</Lastname>
            <Role>Manager</Role>
         </Member>
      </Members>
      <Name>Demo Company</Name>
      <Subscription>Enterprise</Subscription>
      <SubscriptionExpires>2025-01-01T00:00:00+03:00</SubscriptionExpires>
   </Data>
   <Errors i:nil="true" />
   <Message>Operation successful</Message>
   <Page>
      <HasMore>false</HasMore>
      <PageIndex>0</PageIndex>
      <Pages>1</Pages>
      <Records>1</Records>
   </Page>
   <Quote>
      <Max>20000</Max>
      <Remaining>19979</Remaining>
   </Quote>
   <Status>200</Status>
</ApiResponse>

basic Alerts


This command uses a GET request to fetch information about your alerts.

JSON Request:

$ curl -i -H "Accept: application/json" -X GET https://api.pricetrack.eu/v1/alerts?token={YOUR_TOKEN}

XML Request:

$ curl -i -H "Accept: application/xml" -X GET https://api.pricetrack.eu/v1/alerts?token={YOUR_TOKEN}

Sample JSON Response:

{
   "Status": 200,
   "Message": "Operation successful",
   "Quote": {
      "Max": 20000,
      "Remaining": 19998
   },
   "Page": {
      "PageIndex": 0,
      "Pages": 1,
      "Records": 1,
      "HasMore": false
   },
   "Errors": null,
   "Data": [
      {
         "Id": "adcac108-b243-40b4-8c8f-25505508f5d4",
         "Name": "Our price higher than average price for iPhone",
         "Message": "Our price higher than average price for iPhone",
         "Status": "InProgress",
         "Priority": "High",
         "AffectedProducts": 1,
         "Finished": null,
         "Started": "2017-03-01T13:30:04.2321933+03:00"
      }
   ]
}

Sample XML Response:

<?xml version="1.0" encoding="UTF-8"?>
<ApiResponse xmlns="http://schemas.datacontract.org/2004/07/PriceTrack.Web.Api.Models" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
   <Data i:type="ArrayOfAlert">
      <Alert>
         <AffectedProducts>1</AffectedProducts>
         <Finished i:nil="true" />
         <Id>adcac108-b243-40b4-8c8f-25505508f5d4</Id>
         <Message>Our price higher than average price for iPhone</Message>
         <Name>Our price higher than average price for iPhone</Name>
         <Priority>High</Priority>
         <Started>2017-03-01T13:30:04.2321933+03:00</Started>
         <Status>InProgress</Status>
      </Alert>
   </Data>
   <Errors i:nil="true" />
   <Message>Operation successful</Message>
   <Page>
      <HasMore>false</HasMore>
      <PageIndex>0</PageIndex>
      <Pages>1</Pages>
      <Records>1</Records>
   </Page>
   <Quote>
      <Max>20000</Max>
      <Remaining>19997</Remaining>
   </Quote>
   <Status>200</Status>
</ApiResponse>

basic List Brands


This command uses a GET request to fetch information about your brands.

JSON Request:

$ curl -i -H "Accept: application/json" -X GET https://api.pricetrack.eu/v1/brands?token={YOUR_TOKEN}

XML Request:

$ curl -i -H "Accept: application/xml" -X GET https://api.pricetrack.eu/v1/brands?token={YOUR_TOKEN}

basic Create A New Brand


New brands can be created with a POST command to /v1/brands/add path by given parameters in the table as below.

Parameter Description Required Default

Name

Name of the brand

Yes

Code

Code of the brand (set your identity number or code to make it joinable with your local data)

No

JSON Request:

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{ "Name": "Test", "Code": "test-brand" }' https://api.pricetrack.eu/v1/brands/add?token={YOUR_TOKEN}

XML Request:

curl -i -H "Accept: application/xml" -H "Content-Type: text/xml" -X POST -d "<?xml version=\"1.0\" encoding=\"utf-8\"?><Brand xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.datacontract.org/2004/07/PriceTrack.Web.Api.Models\"><Code>test-brand</Code><Name>Test</Name></Brand>" https://api.pricetrack.eu/v1/brands/add?token={YOUR_TOKEN}

Note

Put the xml nodes in alphabetically order in Brand element otherwise non-ordered or missing nodes assume as null.

Sample JSON Response:

{
   "Status": 200,
   "Message": "Operation successful",
   "Quote": {
      "Max": 20000,
      "Remaining": 19999
   },
   "Page": null,
   "Errors": null,
   "Data": {
      "Id": "6a6cfa19-3fe9-4c0a-b342-b71fe6106dfc",
      "Name": "Test",
      "Code": "test-brand"
   }
}

Sample XML Response:

<?xml version="1.0" encoding="UTF-8"?>
<ApiResponse xmlns="http://schemas.datacontract.org/2004/07/PriceTrack.Web.Api.Models" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
   <Data i:type="Brand">
      <Code>test-brand</Code>
      <Id>cd832087-9fc9-44c4-8270-a8e871fa1973</Id>
      <Name>Test</Name>
   </Data>
   <Errors i:nil="true" />
   <Message>Operation successful</Message>
   <Page i:nil="true" />
   <Quote>
      <Max>20000</Max>
      <Remaining>19979</Remaining>
   </Quote>
   <Status>200</Status>
</ApiResponse>

basic List Categories


This command uses a GET request to fetch information about your categories.

JSON Request:

$ curl -i -H "Accept: application/json" -X GET https://api.pricetrack.eu/v1/categories?token={YOUR_TOKEN}

XML Request:

$ curl -i -H "Accept: application/xml" -X GET https://api.pricetrack.eu/v1/categories?token={YOUR_TOKEN}

basic Create A New Category


New categories can be created with a POST command to /v1/categories/add path by given parameters in the table as below.

Parameter Description Required Default

Name

Name of the category

Yes

Code

Code of the category (set your identity number or code to make it joinable with your local data)

No

JSON Request:

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{ "Name": "Test", "Code": "test-category" }' https://api.pricetrack.eu/v1/categories/add?token={YOUR_TOKEN}

XML Request:

curl -i -H "Accept: application/xml" -H Content-Type:text/xml -X POST -d "<?xml version=\"1.0\" encoding=\"utf-8\"?><Category xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.datacontract.org/2004/07/PriceTrack.Web.Api.Models\"><Code>test-category</Code><Name>Test</Name></Category>" https://api.pricetrack.eu/v1/categories/add?token={YOUR_TOKEN}

Note

Put the xml nodes in alphabetically order in Category element otherwise non-ordered or missing nodes assume as null.

Sample JSON Response:

{
   "Status": 200,
   "Message": "Operation successful",
   "Quote": {
      "Max": 20000,
      "Remaining": 19999
   },
   "Page": null,
   "Errors": null,
   "Data": {
      "Id": "6a6cfa19-3fe9-4c0a-b342-b71fe6106dfc",
      "Name": "Test",
      "Code": "test-category"
   }
}

Sample XML Response:

<?xml version="1.0" encoding="UTF-8"?>
<ApiResponse xmlns="http://schemas.datacontract.org/2004/07/PriceTrack.Web.Api.Models" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
   <Data i:type="Category">
      <Code>test-category</Code>
      <Id>cd832087-9fc9-44c4-8270-a8e871fa1973</Id>
      <Name>Test</Name>
   </Data>
   <Errors i:nil="true" />
   <Message>Operation successful</Message>
   <Page i:nil="true" />
   <Quote>
      <Max>20000</Max>
      <Remaining>19979</Remaining>
   </Quote>
   <Status>200</Status>
</ApiResponse>

basic Product Management


This section describes how to create products, list existing inventory and add competitors, and demonstrates the implemention via API with code samples.

basic Create A New Product


New products can be created with a POST command to /v1/products/add path by given parameters in the table as below.

Parameter Description Required Default

Name

Name of the product

Yes

ProductCode

Code of the product (set your identity number or code to make it joinable with your local data)

No

Price

Price of the product (use English decimal format. Ex: 123.45)

No

0

JSON Request:

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{ "Name": "Test Product", "Price": 123.45, "ProductCode": "TEST-123" }' https://api.pricetrack.eu/v1/products/add?token={YOUR_TOKEN}

XML Request:

curl -i -H "Accept: application/xml" -H "Content-Type: text/xml" -X POST -d "<?xml version=\"1.0\" encoding=\"utf-8\"?><Product xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://schemas.datacontract.org/2004/07/PriceTrack.Web.Api.Models\"><Name>Test Product</Name><Price>123.45</Price><ProductCode>TEST-123</ProductCode></Product>" https://api.pricetrack.eu/v1/products/add?token={YOUR_TOKEN}

Note

  • Missing nodes (parameters) assume as null.
  • Put the xml nodes in alphabetically order for the Product element otherwise non-ordered nodes assume as null.

Sample JSON Response:

{
   "Status": 200,
   "Message": "Operation successful",
   "Quote": {
      "Max": 20000,
      "Remaining": 19995
   },
   "Page": null,
   "Errors": null,
   "Data": {
      "Id": "a53695d6-717e-42ec-801e-3b13be89ce80",
      "Name": "Test Product",
      "ProductCode": "TEST-123",
      "Price": 123.45,
      "MinPrice": 0,
      "MaxPrice": 0,
      "AvgPrice": 0,
      "Brands": [],
      "Categories": [],
      "Tags": [],
      "Competitors": []
   }
}

Sample XML Response:

<?xml version="1.0" encoding="UTF-8"?>
<ApiResponse xmlns="http://schemas.datacontract.org/2004/07/PriceTrack.Web.Api.Models" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
   <Data i:type="Product">
      <AvgPrice>0</AvgPrice>
      <Brands xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
      <Categories xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
      <Competitors />
      <Id>528f57a6-2b36-4f67-bbf5-4692781b00ce</Id>
      <MaxPrice>0</MaxPrice>
      <MinPrice>0</MinPrice>
      <Name>Test Product</Name>
      <Price>123.45</Price>
      <ProductCode>TEST-123</ProductCode>
      <Tags xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" />
   </Data>
   <Errors i:nil="true" />
   <Message>Operation successful</Message>
   <Page i:nil="true" />
   <Quote>
      <Max>20000</Max>
      <Remaining>19999</Remaining>
   </Quote>
   <Status>200</Status>
</ApiResponse>

basic Error Handling


If the HTTP response code is not 200 then an error has occurred.

Example Error Server Response:

HTTP/1.1 401 Unauthorized

Often times, in addition to an HTTP error, the server will return error details in the response body. If error data is available in the response body it can be displayed to the client.

Example JSON Error Response:

{
   "Status": 401,
   "Message": "Company not found by given token!",
   "Quote": null,
   "Page": null,
   "Errors": [
      {
         "Title": "Company not found by given token!",
         "Status": 401,
         "Details": "Please check the specified token is valid.",
         "Url": null
      }
   ],
   "Data": null
}

Example XML Error Response:

<?xml version="1.0" encoding="UTF-8"?>
<ApiResponse xmlns="http://schemas.datacontract.org/2004/07/PriceTrack.Web.Api.Models" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
   <Data i:nil="true" />
   <Errors>
      <Error>
         <Details>Please check the specified token is valid.</Details>
         <Status>404</Status>
         <Title>Company not found by given token!</Title>
         <Url i:nil="true" />
      </Error>
   </Errors>
   <Message>Company not found by given token!</Message>
   <Page i:nil="true" />
   <Quote i:nil="true" />
   <Status>401</Status>
</ApiResponse>

Note

There may be more than one error in the Errors element.

basic API Throttle


To ensure a consistent quality of service PriceTrack may block users making a large number of requests over a short period of time or exceeding daily API Quota Limit. Most users will never come close to reaching this limit but if it is reached the server will return a 429 Too Many Requests response with an error message of “API Quota Exceeded” in the standard XML/JSON error format. Developers should anticipate this error and handle accordingly.


Still have questions about the PriceTrack REST API? Submit a Support Ticket