Attendance POST gives JSON error...HELP!

Having a really frustrating time trying to add an attendance entry to a test student. I'm using CURL, with the following request (edited only for security/privacy):

https://api.sky.blackbaud.com/school/v1/attendance

-X POST --header "Content-type: application/json" --header "Bb-Api-Subscription-Key: xxxxxxxxx" --header "Authorization: Bearer xxxxxxxxxxxx" --data-raw "{\\"begin_date\\":\\"2022-04-05T00:00:00-08:00\\",\\"end_date\\":\\"2022-04-05T00:00:00-08:00\\",\\"start_time\\":\\"00:00:00\\",\\"end_time\\":\\"23:59:00\\",\\"excuse_comment\\":\\"Testing\\",\\"excuse_type_id\\":3992,\\"student_user_id\\":444444}"

This generates the following unhelpful error message:

? * Line 1, Column 1
Syntax error: value, object or array expected.
* Line 1, Column 1
A valid JSON document must be either an array or an object value.

It doesn't matter how I massage the CURL Options - it keeps complaining that the JSON isn't properly formatted.

Any help figuring this out would be greatly appreciated!

Thank you.

Comments

  • And there's an error in the docs for the create attendance endpoint:

    The sample data says:

    {
    "student_user_id": 10,
    "begin_date": "2021-09-30T00:00:00Z",
    "end_date": "2021-09-30T00:00:00Z",
    "start_time": "2022-05-11",
    "end_time": "2022-05-11",
    "excuse_type_id": 153,
    "excuse_comment": "College Trip"
    }

    however "2022-05-11" is not a time.

  • And I've tried --data and a single quote enclosing the data doesn't work for my CURL.

    This exact same CURL format (--data-raw and escaped quotes) works perfectly with Raiser's Edge, and other endpoints in School…

  • ARGH! I'm getting the error because I'm trying to parse a NULL response from SKY!

    The error wasn't coming from my POST data - it was because it was added without error and (unlike other endpoints) doesn't give any sort of “success!" reply to a POST.

    It would be awfully nice if SKY gave some sort of confirmation!

  • Jared Harbour
    Jared Harbour Blackbaud Employee
    Eighth Anniversary Kudos 1 Name Dropper Participant

    Hi Julian,

    It is true that the POST attendance route does not return a JSON response, but it does return a HttpResponse of 200 on success. Many POST routes don't need to return any data on success and the HttpResponse is usually enough.

    I found this on Stackoverflow, hopefully it helps!

    https://stackoverflow.com/questions/29243587/curl-post-request-get-response-and-status-code

    Best

    Jared

Categories