Getting 400 Bad Request when creating a Batch through the API
Hi there,
I am working on adding the ability to create gift batches to our integration with RENXT.
For some reason, when I post to the https://api.sky.blackbaud.com/gift-batch/v1/giftbatches endpoint (CreateGiftBatch) through our code, I always receive a 400 Bad Request.
The response received the following error:
{
"errors": {
"": [
"Unexpected character encountered while parsing value: . Path '', line 0, position 0."
],
"batch": [
"The batch field is required."
]
},
"type": "urn:blackbaud:model-validation-error",
"title": "One or more validation errors occurred.",
"status": 400,
"detail": "Unexpected character encountered while parsing value: . Path '', line 0, position 0.\\\\nThe batch field is required.",
"instance": "urn:blackbaud:bat-gbapi:",
"values": {
"": null,
"batch": null
},
"trace_id": "91cbe92571d84a1e919e85bc5de919c2",
"span_id": "55d739d58a5b3ab9"
}
This is suggesting that the JSON body is formatted incorrectly. That said, I did a network trace and I can see that the data being sent in the request body looks correct.
This is the request body being sent to the endpoint:
{"batch_number":"VS_8_01-08-2024"}
The content type and security headers look correct on the web request as well.
I tried this through the SKY API console and the request works fine there. I am not sure why it does not work when calling this from our application. Any help on this would be much appreciated.
Thank you,
Dylan Hochreiter
Comments
-
@Dylan Hochreiter
Let's be more specific here.I am working on adding the ability to create Gifts in a batch
then https://api.sky.blackbaud.com/gift-batch/v1/giftbatches is the incorrect API endpoint, this endpoint creates a gift batch, it does not create gift in batch.
If you are actually trying to create gift batch, not create a gift in batch, then theAPI endpoint and JSON looks correct. Did you make sure you hit the endpoint with POST and content-type is application/json; charset=utf-8
0 -
@Alex Wong Thanks for the feedback Alex.
I agree that start of the post was incorrect, I edited the post so it's more specific. I am trying to create a gift batch.
The content-type is just set to “application/json” but the charset is not mentioned. Let me try that.
0 -
@Alex Wong Unfortunately, it still does not work with the content type updated to "application/json; charset=utf-8".
It's very odd as we call many of the other endpoints the same way without running into an issue like this.
0 -
@Dylan Hochreiter
given you tried it on console and it works fine, (and I tried it on my test environment as well and it works). it is not a problem with the SKY API endpoint. Then that least how you are calling it.Please provide all the details on the exact info on how you are making the call, the request heaader and body, and response header and body
0 -
@Alex Wong I am making the call using the .NET HttpWebRequest Class. I use this method for other calls we make to Blackbaud APIs, including calls to the Payments API, Gift API, Fundraising API and Constituent API.
Here is the details on the request sent and the response received:
Request uri: https://api.sky.blackbaud.com/gift-batch/v1/giftbatches
Request method: “POST”
Request headers:
{
Authorization: Bearer {authToken}
Bb-Api-Subscription-Key: {standardApiSubscriptionKey}
Content-Type: application/json; charset=utf-8;
Host: api.sky.blackbaud.com}
Request body:
{
"batch_number": "VS_8_01-12-2024"
}Response headers:
{
x-content-type-options: nosniff
strict-transport-security: max-age=31536000; includeSubDomains
Content-Length: 531
Cache-Control: no-store, must-revalidate, no-cache
Content-Type: application/problem+json; charset=utf-8
Date: Fri, 12 Jan 2024 18:25:05...}
Response body:
{
"errors": {
"": [
"Unexpected character encountered while parsing value: .... Path '', line 0, position 0."
],
"batch": [
"The batch field is required."
]
},
"type": "urn:blackbaud:model-validation-error",
"title": "One or more validation errors occurred.",
"status": 400,
"detail": "Unexpected character encountered while parsing value:Path '', lne 0, position0.\\nThe batch field is required.",
"instance": "urn:blackbaud:bat-gbapi:",
"values": {
"": null,
"batch": null
},
"trace_id": "f69e23ffbe634ae6a298601e824e0fc1",
"span_id": "6f819c7e20f50109"
}Thank you!
0 -
@Dylan Hochreiter
I can't really tell what is the problem with the info you provided. I do think it is on your end with the .NET application call as the SKY API endpoint does work, from Console to Power Automation flow (what I use). You might want to check the .NET HttpWebRequest class on if data are being “encoded” in a way that SKY API doesn't recognize.Might want to reach out to support (though first level support isn't going to be much help with API stuff, you will have to esculate and see if they can get you an engineer to help. (or maybe someone else on this forum has .NET application experience that can help you further).
Good Luck
1 -
I will look into more on our side and I will reach out to support if I can't figure it out.
Thank you for your help with this!
0
Categories
- All Categories
- 6 Blackbaud Community Help
- 210 bbcon®
- 1.4K Blackbaud Altru®
- 395 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®
- 649 Blackbaud Grantmaking™
- 567 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
- 247 ResearchPoint™
- 119 Blackbaud Tuition Management™
- 165 Organizational Best Practices
- 239 The Tap (Just for Fun)
- 33 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
- 784 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)

