Post a Photo Workflow
Hello bb peeps! I'm new here (as you can tell I'm sure) and I am really struggling with uploading a photo/document/attachment.
I undertsand the workflwo is to:
From step two I get:
HTTP/1.1 100 Continue HTTP/1.1 201 Created Content-Length: 0 Content-MD5: 9+jrlga57xe1lsbdZG4WPA== Last-Modified: Tue, 28 Jul 2020 19:24:50 GMT ETag: "0x8D8332BE5A12BCC" Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 x-ms-request-id: fa2e46c2-d01e-00b7-1914-65523e000000 x-ms-version: 2015-12-11 x-ms-request-server-encrypted: true Date: Tue, 28 Jul 2020 19:24:49 GMT
And then when I try to do step three I get:
I undertsand the workflwo is to:
- Create a document/get instructions from bb by calling the POST Document API
- Uplaod the photo and thumbnail to the urls in the response form above
- Link the document/photo to the constituant
From step two I get:
HTTP/1.1 100 Continue HTTP/1.1 201 Created Content-Length: 0 Content-MD5: 9+jrlga57xe1lsbdZG4WPA== Last-Modified: Tue, 28 Jul 2020 19:24:50 GMT ETag: "0x8D8332BE5A12BCC" Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 x-ms-request-id: fa2e46c2-d01e-00b7-1914-65523e000000 x-ms-version: 2015-12-11 x-ms-request-server-encrypted: true Date: Tue, 28 Jul 2020 19:24:49 GMT
And then when I try to do step three I get:
[
{
"error_code" : 50009,
"error_name" : "DocumentBusinessLogicInvalidUploadedFile",
"message" : "The document has not been uploaded or is invalid.",
"raw_message" : "The document has not been uploaded or is invalid."
}
]
Any thoughts?1
Comments
-
Hi Kevin .
You don't say how you're performing step 3. Are you using POST Constituent attachment with the URL(s) from step 2?
I haven't tried this, but is it possible there might be an escaping issue with the URL(s)? If that's the case, I'd try escaping the URL(s) and see if that makes a difference.
Interested to know how you go.
Cheers,
Steve Cinquegrana | CEO and Principal Developer | Protégé Solutions
0 -
Thank you Steven:
The API documentation says "Using the headers above, make a request to the upload URL with the binary data of your image in the body of the request."
Should it be:- --upload-file
- --data-raw
- --data-binary
- --data-ascii
0 -
Hi Kevin,
You're correct on the 3-step process. Step 2 involves you talking directly to our document storage database (which is, under the hood, Azure blob storage but this is really an internal implementation detail). That error code is returned when our code finds that no bytes have been uploaded to the document store).
I just tested this and it worked:
1. Create a document
I'll use the SKY API Console to invoke the CreateDocument endpoint to create a new document location (and I'll include a thumbnail):
The response is a 200 and the body contains instructions for how/where to upload the bytes for the photo and thumbnail:
POST https://api.sky.blackbaud.com/constituent/v1/documents HTTP/1.1
Host: api.sky.blackbaud.com
Content-Type: application/json
Bb-Api-Subscription-Key: {my api key}
Authorization: Bearer {my access token}
{
"file_name": "photo.jpg",
"upload_thumbnail": true
}
2. Upload the photo and thumbail
{
"file_id": "314fe4cd-1155-41d7-96da-c425ceb1658c",
"file_upload_request": {
"headers": [{
"name": "x-ms-blob-type",
"value": "BlockBlob"
}, {
"name": "x-ms-version",
"value": "2015-12-11"
}],
"method": "PUT",
"url": "https://s21arnx01doc01blkbsa.blob.core.windows.net/blackbauddocumentsvc/tenants/.../documents/314fe4cd-1155-41d7-96da-c425ceb1658c/photo.jpg?sv=2015-12-11&sr=b&sig={my sig}&sp=rw"
},
"thumbnail_id": "a69d193a-68bf-4a3b-82aa-0904a72a2629",
"thumbnail_upload_request": {
"headers": [{
"name": "x-ms-blob-type",
"value": "BlockBlob"
}, {
"name": "x-ms-version",
"value": "2015-12-11"
}],
"method": "PUT",
"url": "https://s21arnx01doc01blkbsa.blob.core.windows.net/blackbauddocumentsvc/tenants/.../documents/a69d193a-68bf-4a3b-82aa-0904a72a2629/thumbnail_photo.jpg?sv=2015-12-11&sr=b&sig={my sig}&se=2021-04-27T19:37:58Z&sp=rw"
}
}
Using Postman (or your preferred tool), I'll upload the file bytes for the photo to the document location described in the file_upload_request property:
Next, I'll upload the bytes for the thumbnail to the document location described in the thumbnail_upload_request property:
PUT https://s21arnx01doc01blkbsa.blob.core.windows.net/blackbauddocumentsvc/tenants/.../documents/314fe4cd-1155-41d7-96da-c425ceb1658c/photo.jpg?sv=2015-12-11&sr=b&sig={my sig}&se=2021-04-27T19:37:58Z&sp=rw
x-ms-blob-type: BlockBlob
x-ms-version: 2015-12-11
Content-Type: image/jpeg
Content-Length: {size in bytes}
PUT https://s21arnx01doc01blkbsa.blob.core.windows.net/blackbauddocumentsvc/tenants/.../documents/a69d193a-68bf-4a3b-82aa-0904a72a2629/thumbnail_photo.jpg?sv=2015-12-11&sr=b&sig={my sig}&se=2021-04-27T19:37:58Z&sp=rw
x-ms-blob-type: BlockBlob
x-ms-version: 2015-12-11
Content-Type: image/jpeg
Content-Length: {size in bytes}The response from both of these actions is a 201 Created with no response body (this is coming from Azure's document storage API)
3. Update the constituent's profile picture
Back in the SKY API Console, I'll use the PatchConstituentProfilePicture endpoint to update the constituent's profile picture:
PATCH https://api.sky.blackbaud.com/constituent/v1/constituents/{constituent ID}/profilepicture HTTP/1.1
Host: api.sky.blackbaud.com
Content-Type: application/json
Bb-Api-Subscription-Key: {my api key}
Authorization: Bearer {my access token}
{
"document_id": "314fe4cd-1155-41d7-96da-c425ceb1658c",
"file_name": "photo.jpg",
"thumbnail_id": "a69d193a-68bf-4a3b-82aa-0904a72a2629"
}
The response from SKY API here is a 200, and if I navigate to the constituent record I'll see the updated profile picture.0
Categories
- All Categories
- 6 Blackbaud Community Help
- 211 bbcon®
- 1.4K Blackbaud Altru®
- 396 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1.1K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 15 donorCentrics®
- 360 Blackbaud eTapestry®
- 2.5K Blackbaud Financial Edge NXT®
- 650 Blackbaud Grantmaking™
- 568 Blackbaud Education Management Solutions for Higher Education
- 3.2K Blackbaud Education Management Solutions for K-12 Schools
- 937 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 84 JustGiving® from Blackbaud®
- 6.5K Blackbaud Raiser's Edge NXT®
- 3.7K SKY Developer
- 248 ResearchPoint™
- 119 Blackbaud Tuition Management™
- 165 Organizational Best Practices
- 239 The Tap (Just for Fun)
- 34 Blackbaud Community Challenges
- 31 PowerUp Challenges
- 3 (Open) PowerUp Challenge: Data Health
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Product Update Briefing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports+
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Email Marketing
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Event Management
- 3 (Closed) Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 (Closed) Raiser's Edge NXT PowerUp Challenge: Query
- 785 Community News
- 2.9K Jobs Board
- 53 Blackbaud SKY® Reporting Announcements
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)

