SQL Server / ShippingEasy API / Get Orders for Specific Store
Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
DECLARE @queryParams int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @queryParams OUT
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'api_signature', '{{api_signature}}'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'api_timestamp', '{{api_timestamp}}'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'api_key', '{{API Key}}'
DECLARE @resp int
EXEC sp_OAMethod @http, 'QuickRequestParams', @resp OUT, 'GET', 'Key}}/orders', @queryParams
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
RETURN
END
EXEC sp_OAGetProperty @resp, 'StatusCode', @iTmp0 OUT
PRINT @iTmp0
EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
END
GO
Curl Command
curl -G -d "api_signature=%7B%7Bapi_signature%7D%7D"
-d "api_timestamp=%7B%7Bapi_timestamp%7D%7D"
-d "api_key=%7B%7BAPI%20Key%7D%7D"
https://app.shippingeasy.com/api/stores/{{Store API Key}}/orders
Postman Collection Item JSON
{
"name": "Get Orders for Specific Store",
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"// calculate timestamp",
"const timestamp = parseInt(Date.now() / 1000);",
"console.log(\"timestamp: \" + timestamp);",
"pm.variables.set(\"api_timestamp\", timestamp);",
"",
"// Set your API key and API secret as Postman environment variables, your key and secret are available at https://app.shippingeasy.com/settings/api_credentials",
"const apiKey = pm.environment.get(\"API Key\");",
"const apiSecret = pm.environment.get(\"API Secret\");",
"",
"const storeApiKey = pm.environment.get(\"Store API Key\");",
"",
"// build signature string - https://shippingeasy.readme.io/docs/authentication-signing-requests#how-to-calculate-a-signature",
"const signatureString = pm.request.method + \"&\" +",
" \"/api/stores/\" + storeApiKey + \"/orders&\" +",
" \"api_key=\" + apiKey + \"&\" +",
" \"api_timestamp=\" + timestamp;",
"console.log(\"signature string: \" + signatureString);",
"",
"// generate signature",
"const apiSignature = CryptoJS.HmacSHA256(signatureString, apiSecret).toString(CryptoJS.enc.Hex);",
"console.log(\"api request signature: \" + apiSignature);",
"pm.variables.set(\"api_signature\", apiSignature);"
]
}
}
],
"request": {
"method": "GET",
"header": [
],
"url": {
"raw": "app.shippingeasy.com/api/stores/{{Store API Key}}/orders?api_signature={{api_signature}}&api_timestamp={{api_timestamp}}&api_key={{API Key}}",
"host": [
"app",
"shippingeasy",
"com"
],
"path": [
"api",
"stores",
"{{Store API Key}}",
"orders"
],
"query": [
{
"key": "api_signature",
"value": "{{api_signature}}"
},
{
"key": "api_timestamp",
"value": "{{api_timestamp}}"
},
{
"key": "api_key",
"value": "{{API Key}}"
}
]
},
"description": "Get details on the stores / marketplaces (i.e. Shopify/BigCommerce/Amazon/etc) that you have integrated with ShippingEasy.\n\nThe Manual Order store is the default / built in store for your ShippingEasy account."
},
"response": [
]
}