500 error on Users phone create POST

Other GETs and POSTs are working fine, but this is my first time using the “Users phone create” endpoint. Instead of a meaningful error message, I get an unhelpful 500 error.

I see that this appears to be an issue with phones in the Constituent API as well, and the Blackbaud K12 web front end has been particularly flaky with phone numbers recently (including giving me a 403 Forbidden Error when trying to change phone types):

Here's my (edited for privacy) request:

-X POST --header "Content-type: application/json" --header "Bb-Api-Subscription-Key: [SNIPPED]" --header "Authorization: Bearer [SNIPPED]" --data-raw "{\\"links\\":[{\\"id\\":4905,\\"shared_relationship\\":\\"Parent\\",\\"shared_user\\":\\"John Doe\\",\\"type_id\\":\\"Wireless\\",\\"user_id\\":4[SNIPPED]2}],\\"number\\":\\"+1-250-555-1212\\",\\"type_id\\":4905}"

(in my case, typeid 4905="Home 2". I'm not entirely clear why I would use typeid:4905 (Home 2) for the main constituent and then id:4905 & typeid:"Wireless" in the links array, but that's the way the info was presented when I did a GET and the SKY API documentation isn't at all clear. From the GET:

{
"id" : 4[SNIPPED]1,
"index_id" : 3[SNIPPED]0,
"links" :
[
{
"id" : 4905,
"shared" : false,
"type_id" : "Home 2",
"user_id" : 4[SNIPPED]5
},
{
"id" : 4905,
"shared" : true,
"shared_relationship" : "Parent",
"shared_user" : "John Doe",
"type_id" : "Wireless",
"user_id" : 4[SNIPPED]2
}
],
"number" : "+1-250-555-1212",
"phone_type" : "Home 2",
"type_id" : 4905,
"user_id" : 4[SNIPPED]5
}

Is this 500 error a bug? or am I doing something wrong…and if so, what?

Comments

  • Todd DeSchuiteneer
    Todd DeSchuiteneer Blackbaud Employee
    Tenth Anniversary Kudos 3 Name Dropper Participant

    @Julian Daniel
    This doesn't seem to be a bug. 500 errors aren't very specific usually because something is wrong information sent and the system doesn't have a more specific issue to point out. Testing the endpoint I am able to post a new number without a problem. I believe the root of your problem is how you have the body formatted.

    In the sample code provided on the endpoint:

    The body is formatted with the number and the type ID at the top with the shared info listed on the interior:

    {
    "number": "string",
    "type_id": 0,
    "links": [
    {
    "id": 0,
    "shared": true,
    "shared_relationship": "string",
    "shared_user": "string",
    "type_id": "string",
    "user_id": 0
    }
    ]
    }

    If you POST with that format you should be able to add the number without issue.

    In the sample you provided you also have the phone type listed under the shared id (which should be a user ID, and where type ID is listed you have Wireless or Home 2 when this should be a numerical value.

    “id” : 4905 ←-this should be a user ID

    “type_id” : “Wireless” ←- this should be the numerical value assigned to each type you can retrieve from the endpoint below.

    You also may want to check the phone type IDs here:

    as that phone ID you have listed seems a bit off to me.

Categories