This article explains how an Enterprise retailer can use the Product Cost API to query an array of SKUs or Products at any given metal lock of your choice and return a cost.
Sending your Request
File Format:
Download example file here: Query
Atelier_Code: The unique identifier for a product in the Atelier system (this value can be obtained from your BoM Export)
Home_Currency: The currency your administrator has configured for your account. We need this in order to validate that the metal locks you are passing in the request correlate to the cost data in your Atelier account (this 3 digit currency code that can be found under company Settings > Currencies & Sizes > Company Home Currency)
Gold_Metal_Lock: The Troy ounce (31.1035g) gold metal market value you wish to export your gold product costs for. Acceptable values:
- Numerical 2 decimal places
- Minimum Value 0.01,
- Maximum Value 999,999,999.99
- Can also be left empty (null)
⚠️ Null Value Behaviour
If your query contains a product for which no relevant metal lock is passed in your query, we will not recalculate your product cost, we will return the current product cost from your company Linesheet.
Silver_Metal_ Lock: The Troy ounce (31.1035g) pure silver metal market value you wish to export your silver product costs for. Accepted values:
- Numerical 2 decimal places
- Minimum Value 0.01,
- Maximum Value 999,999,999.99
- Can also be left empty (null)
⚠️ Null Value Behaviour
If your query contains a product for which no relevant metal lock is passed in your query, we will not recalculate your product cost, we will return the current product cost from your company Linesheet.
Platinum_Metal_Lock: The Troy ounce (31.1035g) pure platinum metal market value you wish to export your platinum product costs for. Accepted values:
- Numerical 2 decimal places
- Minimum Value 0.01,
- Maximum Value 999,999,999.99
- Can also be left empty (null)
⚠️ Null Value Behaviour
If your query contains a product for which no relevant metal lock is passed in your query, we will not recalculate your product cost, we will return the current product cost from your company Linesheet.
⚠️ Metal Buffer Complexities
It is important to understand that with a certain combination of criteria, your returned value will either remove or include a metal buffer % that is applied against a product in your product array.
Remove logic:
Given that in my request I have passed an Atelier code where metal status is live and provided a valid metal value that is not ‘null’ for this product variant
When I am returned the FOB and Calculated cost
Then any live metal lock buffer % used in the system FOB cost calculations will be ignored (as I am specifying an exact metal lock in my request)
Ignore Logic:
Given that in my request I have passed an Atelier code where metal status is live but I have not provided a metal value for this product variant
When I am returned the FOB and Calculated cost
Then any live metal lock buffer % used in the system FOB cost calculations will be included (so I should be aware that if this product variant carries a live metal buffer % in the Atelier application then the FOB Cost display in my response will not correlate exactly to the metal value displayed in the response, rather metal value displayed + live metal buffer %)
Understanding Your Response
File Name:
The file naming convention for the files you will retrieve in your response is as follows:
passed_file_name-response_po_cost_array-YYYYMMDDHHMMSS.csv
Example:
your_file_name-response_po_cost_array-211029000000.csv
🕑 Time format is always 24 hours in our application (so 23:59 not 11:59pm)
File Format:
Download an example file: Response
⚠️ Understanding Live versus Locked Status
Where your relevant metal lock status on your company Linesheet is set to Live, when you pass a query containing this product and a relevant metal lock value, your response will contain a recalculated product cost using the metal lock value from your query.
Where your relevant metal lock status on your company Linesheet is set to Locked, when you pass a query containing this product and a relevant metal lock value, your response will not recalculate a product cost using the metal lock value from your query, it will instead return the Locked metal lock value and the associated product cost.
Atelier_Code: The unique identifier for a product in the Atelier system (this value can be obtained from your BoM Export)
Error: This column will contain an error message if you have a row-level error in your query.
💡 Row-level errors:
- The currency code does not match your home currency code in Atelier
- There is at least one invalid metal lock value in the request. All values should be in your company home currency with a maximum numerical value of 999,999,999.99
- The Atelier Code included in the request is not available on your company linesheet
FOB_Cost: The calculated Freight on Board (Ex-Factory) cost of a Product at the specified metal lock value in the Metal Value Used In Cost Calculation column, expressed in the Supplier Quote Currency
Supplier_Quote_Currency: The currency of the FOB Cost displayed
- Live (fluctuating)
- Locked (fixed)
- empty (null) when metal not contained in product
- Numerical 2 decimal places
- Minimum Value 0.01,
- Maximum Value 999,999,999.99
- Will be empty (null) if the metal is not contained in the product
- Numerical 2 decimal places
- Minimum Value 0.01,
- Maximum Value 999,999,999.99
- Will be empty (null) if the metal is not contained in the product
- Live (fluctuating)
- Locked (fixed)
- empty (null) when metal is not contained in the product
- Numerical 2 decimal places
- Minimum Value 0.01,
- Maximum Value 999,999,999.99
- Will be empty (null) if the metal is not contained in the product
- Numerical 2 decimal places
- Minimum Value 0.01,
- Maximum Value 999,999,999.99
- Will be empty (null) if the metal is not contained in the product
- Live (fluctuating)
- Locked (fixed)
- empty (null) when metal is not contained in the product
- Numerical 2 decimal places
- Minimum Value 0.01,
- Maximum Value 999,999,999.99
- Will be empty (null) if the metal is not contained in the product
Platinum_Metal_Value_Live: platinum metal value in your company's home currency based on the live fluctuating metal market at the time of the query. Expected values:
- Numerical 2 decimal places
- Minimum Value 0.01,
- Maximum Value 999,999,999.99
- Will be empty (null) if the metal is not contained in the product
⚠️ Understanding Set behaviour in Product Cost Array
Understanding Calculations in the Response
- The Calculated_Cost is the sum for the set = Sum [contained set item Calculated_Cost * qty in set]
- Where Supplier_Quote_Currency is the same for all contained set items the FOB_Cost value for the set = Sum [contained set item FoB_Cost * qty in set]
- If at least one of the contained set items is quoted in a different currency than the rest of the set then the FOB Cost and the Supplier Quote Currency fields will be empty for that set row
- Where contained set item has metal lock status = live, then the passed metal value is used to calculate cost
- Where contained set item has metal lock status = locked, then the locked metal value is used to calculate cost
Understanding Metal in the Response
- The Metal_Status (live versus locked) will be empty for the set row because it could be different across the contained set items so we cannot return a single value
- The Metal_Value_Used_in_Cost will be empty for the set row because it could be different across the contained set items so we cannot return a single value
Authentication
Exports API calls require authentication and should be performed using a valid access token.
Please follow the instructions here for Authentication.
This is the documentation relevant to the LinesheetSamplesExport.
Deliver Product Cost Request
To initiate a Product Cost request deliver your payload to this end point:
End Point:
https://enterprise.atelier.technology/api/Imports/pocostarray
For example requests and to test this end-point here is the direct Swagger link: Get Exports
Response:
Use POST and in the response, you will be able to see the ID of your export:
{
"value":{
"id":"904/inbound/po-cost-array/a16fb8397f284028b06ada1b0af63429.csv",
"fileId":"a16fb839-7f28-4028-b06a-da1b0af63429"
},
"next":null,
"_links":{
"get":{
"href":"api/imports/pocostarray/a16fb839-7f28-4028-b06a-da1b0af63429",
"method":"GET",
"title":"",
"templated":false
}
}
}
Example Error Response:
The below error will show if your file is larger than 25mb:
{
"errors":{
"":[
"Failed to read the request form. Request body too large."
]
},
"type":"https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title":"One or more validation errors occurred.",
"status":400,
"traceId":"00-3d2a92ff19521b45874bcb16327f1f1a-4e193f765cd59046-00"
}
The below error will show if your file structure is not correct:
coming soon!
Check Status of Product Cost Request
To check the status of a Product Cost request use this end-point and append the fileID you were served in your request response:
End Point:
https://enterprise.atelier.technology/api/Imports/pocostarray/<insertyourguidID>
Example compilation from the documentation above:
https://enterprise.atelier.technology/api/Imports/pocostarray/a16fb839-7f28-4028-b06a-da1b0af63429
For example requests and to test this end-point here is the direct Swagger link: Get Exports
Response:
Use POST and in the response, you will be able to see the ID of your export:
{
"value": {
"item": {
"status": "ReadyForDownload",
"id": "eb3b5290-b8ab-4c15-b82e-2aa9a5a94ec9",
"resultUrl": "https://po-cost-arrayq.s3.us-east-2.amazonaws.com/904/outbound/po-cost-array/7fbc076ad4c04dca9fee4b98baa26dd6-response_po_cost_array-20211025060541.csv?X-Amz-Expires=3600&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAUBYKXLXUAARLTWSR/20211025/us-east-2/s3/aws4_request&X-Amz-Date=20211025T063345Z&X-Amz-SignedHeaders=host&X-Amz-Signature=8550e66b567795eb4ee16485658f8e711df9b191470a242ae0527363e7498032",
"urlValidUntil": "2021-10-25T07:33:45.1549619Z"
},
"message": null,
"errorCode": null,
"isSuccessful": true
},
"next": null,
"_links": null
}
💡 Retrieving from a Static S3 location?
Use the FileID to be sure you retrieve the correct file from S3.