Examples - Instruction service (Introducer) Introducer
Retrieve an instruction and update it's references
This example
- Retrieves an instruction using the TMP Reference
- Updates the introducer references
- Retrieves an instruction using the Introducer Integration Reference and Introducer Customer Reference
@host=https://api.themovingportal.dev
@auth=BASICAUTHHEADER
@tmpReference=TMP123456
@introducerIntegrationReference=INTRODUCER-INT-REF-{{tmpReference}}
@introducerCustomerReference=INTRODUCER-CUST-REF-{{tmpReference}}
###
# name Get instruction
GET {{host}}/Instruction/{{tmpReference}}
Authorization: Basic {{auth}}
### Update references
PUT {{host}}/instruction/{{tmpReference}}/introducerreferences
Authorization: Basic {{auth}}
Content-Type: application/json
{
"uniqueCustomerReference": "{{introducerCustomerReference}}",
"uniqueIntegrationReference": "{{introducerIntegrationReference}}"
}
### Get instruction using integration reference
GET {{host}}/Instruction/introducer/{{introducerIntegrationReference}}
Authorization: Basic {{auth}}
### Get instruction using customer reference
GET {{host}}/Instruction/introducer/{{introducerCustomerReference}}
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}");
}
