Using Microsoft Dynamics 365 Business Central (Power Automate)
To use the CubeMaster API, you need an API key (TokenID) for authentication. Here's how to get started:
TokenID (e.g., abc123xyz789). Copy this key and store it securely, as it will be used in the HTTP headers of your API requests.Note: The TokenID will be used in the HTTP headers of your POST request for authentication.
A RESTful API is a way for systems like Dynamics 365 to talk to external services like CubeMaster:
https://api.cubemaster.net/loads where you send data.We’ll send shipment data from Dynamics 365 to CubeMaster and get back a detailed load plan.
Prepare Dynamics 365 to integrate with the CubeMaster API:
https://yourcompany.crm.dynamics.com).Use Dynamics 365 order or shipment data to build the JSON request for https://api.cubemaster.net/loads:
{
"Title": @{triggerOutputs()?['body/name']},
"Description": @{triggerOutputs()?['body/description']},
"Cargoes": [
{
"Name": @{triggerOutputs()?['body/_productid_value@OData.Community.Display.V1.FormattedValue']},
"Length": @{triggerOutputs()?['body/new_length']},
"Width": @{triggerOutputs()?['body/new_width']},
"Height": @{triggerOutputs()?['body/new_height']},
"Weight": @{triggerOutputs()?['body/new_weight']},
"OrientationsAllowed": "OrientationsAll",
"TurnAllowedOnFloor": false,
"Qty": @{triggerOutputs()?['body/quantity']},
"ColorKnownName": "Brown"
}
],
"Containers": [
{
"VehicleType": "Dry",
"Name": "53FT-Intermodal",
"Length": 630,
"Width": 98,
"Height": 106,
"ColorKnownName": "Blue"
}
],
"Rules": {
"IsWeightLimited": true,
"IsSequenceUsed": false,
"FillDirection": "FrontToRear",
"CalculationType": "MixLoad"
}
}
Notes:
productid, quantity, etc.new_length) via "Settings" > "Customizations" > "Customize the System."triggerOutputs()?['body/salesorderdetails'].Send the request to CubeMaster using Power Automate:
https://api.cubemaster.net/loads.Authorization, Value: Bearer @{variables('TokenID')}Content-Type, Value: application/jsonProcess and store the response:
{
"status": "succeed",
"message": "Engine created. 5 cargoes. 1 empty containers. Calculation started. Calculation ended. The load built successfully. The load saved to the cloud database.",
"document": {
"title": "New Mixed Truck Load",
"calculationTimeInSeconds": 0.6152743
},
"loadSummary": {
"cargoesLoaded": 68,
"volumeLoaded": 5261723.4606,
"weightLoaded": 42674.59999999999
},
"filledContainers": [
{
"name": "#1 53FT-Intermodal",
"loadSummary": {
"volumeUtilization": 80.39990374424703
},
"graphics": {
"images": {
"path3DDiagram": "https://api.cubemaster.net/runtimes/b28413ca_51ed_44c9_b92e_13147363fd61.PNG"
}
}
}
]
}
new_volumeutilization to body('Parse_JSON')?['filledContainers']?[0]?['loadSummary']?['volumeUtilization'].Techniques for monitoring and debugging your API integration:
401 Unauthorized (invalid TokenID) or 400 Bad Request (malformed JSON) using Power Automate "Configure run after" settings.