======= Ordered Models Statistics API ======= ===== What is the Ordered Models Statistics API? ===== The Ordered Models Statistics API allows you to retrieve the details of all the models that were ordered through our platform. The response returns a list of all the models for a given time period. ===== Who Should Use this API? ===== The Ordered Models Statistics API is for for referral partners to follow up the ordered models of customers they have been forwarding to i.materialise. ===== How Does it Work? ===== This API requires the personal API code. It is therefore not possible to use AJAX requests. The Ordered Models Statistics API works by retrieving data from our service. To specify the exact content type which your client can accept and parse, the Accept header in your request has to be set to one of the following encoding types: * text/json * application/json * text/xml * application/xml The API code needs to be specified in the API code HTTP header. ===== Try it Out ===== The Ordered Models Statistics API can be tried out over our demo page: https://i.materialise.com/api/demo/ordered-models-statistics-api.htm ===== Documentation ===== The Ordered Models Statistics API gives a detailed information about all ordered models for a specified date range that were placed with different toolIDs linked to one API code. ==== Structure of the request ==== Request should be done using HTTP GET request to: https://<>/web-api/models/orderstatus === Request header === ^ What ^ Type ^ Required? ^ Explanation ^ | Header>\\ ApiCode | String (36) required format: GUID | Yes | API code received from i.materialise. This parameter should be sent in the **header** of the request. | | Header>\\ Accept | String | No (“text/xml” is used by default) | Preferred Content Type: “application/json” or “text/xml”. This parameter should be sent in the **header** of the request. | === Request parameters === ^ What ^ Type ^ Required? ^ Explanation ^ | dateFrom | String (10) required format: DD-MM-YYYY | No | Start date of date range for which to select results. This parameter indicates date of upload. | | dateTo | String (10) required format: DD-MM-YYYY | No | Finish date of date range for which to select results. This parameter indicates the date of upload. | | skip | Integer | No | Indicates number of entities to be skipped while fetching data from API. \\ If it’s not indicated, 0 is a default value. | | take | Integer | No | Indicates number of entities to be taken from API \\ If it’s not indicated, 50 is a default value. Maximum is 200. | === Request example=== The request will look like this //(parameters names are not case-sensitive)//: https://<>/web-api/models/orderstatus?dateFrom=01-10-2016&dateTo=31-12-2016&skip=5&take=10 ==== Structure of the Response ==== === General Section of the Response === ^Parameter ^Type ^Always shown? ^Description^ |''dateFrom'' |Date |Yes |The same as in the request| |''dateTo'' |Date |Yes |The same as in the request or the current date if it wasn't specified| |''total'' |Integer |Yes |Total number of ordered Models| |''models'' |List of parameters |Yes |Information about the ordered Models that match the request| === Models Section of the Response === ^Parameter ^Type ^Always shown? ^Description^ |''modelID'' |String (36) format: GUID |Yes |Model ID| |''uploadDate'' |Date |Yes |Date of Model Upload| |''modelFileName'' |String |Yes |File name| |''totalOrdered'' |Integer |Yes |Calculated number of model instances which were added to at least one order with statuses: \\ - Ordered\\ - Processing\\ - In Production\\ - Ready To Ship\\ - Shipped\\ - Delivered | |''totalCanceled'' |Integer |Yes |Calculated number of model instances which were added to at least one order with status - Cancelled| |''totalShipped'' |Integer |Yes |Calculated number of model instances which were added to at least one order with statuses: \\ - Ready To PickUp\\ - Shipped\\ - Delivered | === Response example === If the request is processed successfully, the response looks like this: **Response example in JSON** { "models":[ { "modelId":"9796b4b6-3623-492a-9f43-464b3981cd5a", "uploadDate":"25-10-2016", "modelFileName":"10x10x10.stl", "totalOrdered":1, "totalCanceled":0, "totalShipped":0 }, { "modelId":"553eee43-38a4-4b55-b760-14bb7c29d650", "uploadDate":"25-10-2016", "modelFileName":"10x10x10.stl", "totalOrdered":1, "totalCanceled":0, "totalShipped":0 } ], "total":78, "dateFrom":"01-10-2016", "dateTo":"02-11-2016" } **Response example in XML** 01-10-2016 02-11-2016 9796b4b6-3623-492a-9f43-464b3981cd5a 25-10-2016 10x10x10.stl 1 0 0 553eee43-38a4-4b55-b760-14bb7c29d650 25-10-2016 10x10x10.stl 1 0 0 78 ==== Errors ==== === API code verification === If a wrong/empty API code is used, then a 401 error is returned with the response statusText=”Unauthorized”. === General errors === The parameter “Error” is added to the request only if the request wasn’t processed successfully. The value of this parameter is set according to the table below. If the request wasn’t processed successfully, the list of models will be empty. ^ Code ^ Description ^ Message ^ | 1 | API code not recognized | API code not recognized | | 202 | Incorrect format of DateFrom or DateFrom is empty | Please provide DateFrom in format DD-MM-YYYY or YYYY-MM-DD | | 203 | Incorrect format of DateTo or DateTo is empty | Please provide DateTo in format DD-MM-YYYY or YYYY-MM-DD | | 204 | Wrong date range | DateFrom should be less or equal to DateTo | | 205 | The structure of the request is wrong (some needed parameters are not found or filled in incorrectly) | Wrong request body. Check if all parameters set correctly | | 253 | Skip parameter is too large | Skip request parameter is bigger than Total , please choose more suitable value. Total is response parameter. | | 254 | Take parameter is larger than maximum take value | Value of take request parameter is bigger than maximum Take value. Please choose more suitable value. | | 255 | Take parameters is less than 0 | Value of take request parameter is less than 0, please choose more suitable value. | **Example of Response with error in JSON** { "total":0, "error":{ "message":"Value of take request parameter is less than 0, please choose more suitable value.", "code":255 } } **Example of Response with error in XML** Skip request parameter is bigger than Total, please choose more suitable value. Total is response parameter. 253 0