Examples - Instruction service (Supplier) Supplier
Retrieve an instruction and update it's references
This example
- Retrieves an instruction using the TMP Reference
- Updates the supplier references
- Retrieves an instruction using the Supplier Integration Reference and Introducer Customer Reference
@host=https://api.themovingportal.dev
@auth=BASICAUTHHEADER
@tmpReference=TMP123456
@supplierIntegrationReference=SUPPLIER-INT-REF-{{tmpReference}}
@supplierCustomerReference=SUPPLIER-CUST-REF-{{tmpReference}}
###
# name Get instruction
GET {{host}}/Instruction/{{tmpReference}}
Authorization: Basic {{auth}}
### Update references
PUT {{host}}/instruction/{{tmpReference}}/supplierreferences
Authorization: Basic {{auth}}
Content-Type: application/json
{
"uniqueCustomerReference": "{{supplierCustomerReference}}",
"uniqueIntegrationReference": "{{supplierIntegrationReference}}"
}
### Get instruction using integration reference
GET {{host}}/Instruction/supplier/{{supplierIntegrationReference}}
Authorization: Basic {{auth}}
### Get instruction using customer reference
GET {{host}}/Instruction/supplier/{{supplierCustomerReference}}
Authorization: Basic {{auth}}
Retrieve a file
This example retrieves a file (normally the finished report).
###
@host=https://api.themovingportal.dev
@auth=BASICAUTHHEADER
@tmpReference=TMP123456
GET {{host}}/Instruction/{{tmpReference}}/file/Report.pdf
Authorization: Basic {{auth}}
Typical code to retrieve the file might be:
var httpClient = httpClientFactory.Create();
// Add headers for authentication
var url = "URL HERE";
using var response = await httpClient.GetAsync(url);
if (response.StatusCode == System.Net.HttpStatusCode.OK)
{
var file = await response.Content.ReadAsByteArrayAsync();
var savedFileNameName = "downloaded.pdf";
File.WriteAllBytes(savedFileName, file);
}
else
{
Console.WriteLine("Failed to retrieve file");
Console.WriteLine($"Response Status Code {response.StatusCode}");
var errors = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Errors: {errors}");
}
