Read Submission Image
Introduction
This API returns base64 encoded PDF data for all images associated with the submission requested.
This includes:
- Images uploaded by the user when the submission was created digitally. This could be through a Blackhawk Network hosted Promocenter, through the PromoB2B APIs or a custom online site.
- Image scanned by Blackhawk Network during submission processing for physical documents sent via mail.
- Documents attached during the resubmission process (digital or physical).
Method | Service | API Name | Service Type |
---|---|---|---|
GET | submissions | readimage | Synchronous |
URI: https://{baseUrl}/submissions/v1/readimage/{bpId}/{trackingNumber}
Header Elements
The header must contain the elements needed to authenticate the request.
Parameter | Description | Type | Required |
---|---|---|---|
authorization | This is where you will send your encoded JWT auth token you obtained from Get Auth Token. Must be in the form: Authorization: Bearer {auth-token-string} | String | Yes |
Request Elements
The following parameters are required in the request URI.
Name | Description | Type | Required |
---|---|---|---|
bpId | The unique identifier for the business partner. This value will be provided to you by your Account Manager. | String | Yes |
trackingNumber | The tracking number associated with the submission to be tracked. | String | Yes |
Request Sample
GET https://certification.promob2b.bhnapi.com/submissions/v1/readimage/33377/876779910 HTTP/1.1
content-type: application/json
accept: application/json
Host: certification.promob2b.bhnapi.com
authorization: Bearer eyJraWQiOiJqZV9GRWtTRTFzVG1CNEZuQXBzTFhLLTZPWDNfdGF6OHp6VXlYZzA3V1U4IiwiYWxnIjoiUlMyNTYifQ.eyJ2ZXIiOjEsImp0aSI6IkFULmNYcks2ZEdqd3BPQ2F4a1B5M3k5RTVBMlM4ZlBQaGxoRU4xVHNhZjBMcHciLCJpc3MiOiJodHRwczovL2JobmV0d29ya3BwLm9rdGFwcmV2aWV3LmNvbS9vYXV0aDIvYXVzcWhxamlhYnVzaTFTRlgwaDciLCJhdWQiOiJodHRwczovL2NlcnRpZmljYXRpb24ucHJvbW9iMmIuYmhuYXBpLmNvbSIsImlhdCI6MTYwMjAyMzUzNCwiZXhwIjoxNjAyMDI0MTM0LCJjaWQiOiIwb2FydWM4cTJsTXNBRTZ0ZjBoNyIsInNjcCI6WyIqL2RlZmF1bHQvKiJdLCJzdWIiOiIwb2FydWM4cTJsTXNBRTZ0ZjBoNyJ9.DCezO8LAFbgbl80w3iy2nMuZDjzIcIA2ajottBguT7H2vM4a6Mu6U9cwHnPKwGjbmRgyRqTDO3AlSaqjJfq16mE7xRqyV8s4kEiAetv8XYYhNehbBosETk7ULfxqFfyTTrEtASRvK1I9WzK9HjgLbEqKtAiZ-bV6jDLqH5S_J9C2UK77svv4UoksDhlkEWUqb3ibvquJf073_yOznp5UMmGzTjesXwI5qAfqy_tKJ64B_q9bFU8R2bC53XgLKu-J06xFzy1IHFaSuzl-Xjj9k66X65aFh_7OPX2cg-axSARI7_RXDvMN_IdJM1vZDyt4GFrAkt-OeczomGE7fA0gWQ
Response Elements
Name | Description | Type | Required |
---|---|---|---|
timestamp | Timestamp when the request completed processing. | Integer | Yes |
status | Status of the response. This will match the HTTP Status Code in the header of the response. Example: 404 | String | Yes |
error | If the request was not processed successfully this will indicate the error condition encountered. Example: "Not Found" | String | Yes (if status is ERROR ) |
message | The detailed error message. This will be null if the request completed successfully. | String | Yes (if status is ERROR ) |
path | The path called in the request excluding the baseUrl. | String | Yes |
data | Base64 encoded string of PDF data for the images. | String | No |
Response Sample
Note: In the case no images exist for a submission, or the submission does not exist within your bpId you will receive a 404 HTTP status code.
{
"status": 200,
"error": "",
"message": "",
"path": "/submissions/v1/readimage/33377/876779910",
"timestamp": 1602023555420,
"correlationId": "1-5f7cf07e-5cfc561d21bd4a413592c190",
"data": "[BASE64 ENCODED DATA]"
}
{
"status": 404,
"error": "Not Found",
"message": "Tracking Number and BPID combination not found",
"path": "/submissions/v1/readimage/33377/896779910",
"timestamp": 1602109980250,
"correlationId": "1-5f7e421c-2dd143371f12830b26818aa3",
"data": null
}
{
"status": 401,
"message": "Unauthorized",
"error": "UNAUTHORIZED",
"path": "/submissions/v1/readimage/33377/876779910",
"correlationId": "4596d362-9bf1-4532-8922-1a939a4eeb52",
"timestamp": "07/Oct/2020:22:31:07 +0000"
}
Decoding the Response
Since the data
attribute contains base64 encoded PDF data you will need to decode it and associate with the correct mime-type or file type depending on your use case.
In Java the response could be decoded as shown in the example below:
String encoded = “paste_base64_string”;
byte[] decoded = Base64.getDecoder().decode(encoded);
Updated over 4 years ago