Blank Fields for Importing?

I'm rather new to SKY API and Raiser's Edge.

I'm currently having an issue when doing some test imports for Constituents.

SKYAPI Reference for importing Constituents:



I can import a constituent through the API, but if any fields are left blank, the run just shuts down with a code 400 error: "Response 400 Bad Request Returned when the specified request body is not in the appropriate format."

A very simple example of this, since the only required field is “type:”

This run works:
Type: Individual -----------------------------Type: Individual

Last: Ross -------------------------------------Last: Smith

First: Bob --------------------------------------First: John

This run does import Bob, but the run will end with John:
Type: Individual -----------------------------Type: Individual

Last: Ross --------------------------------------Last: Smith

First: Bob ---------------------------------------First: John

email: address: bross@gmail.com ----email: address:

email: type: E-mail --------------------------email: type:


Is there a way to avoid this without putting in some kind of placeholder value such as “none@none.com” with a type of “Delete Me”?


Comments

  • Chris Rodgers
    Chris Rodgers Blackbaud Employee
    Ninth Anniversary Kudos 3 Name Dropper Participant

    Hi Nicholas,

    As mentioned in your post, when the `email` property is entirely excluded from your request body, you should not receive this error. When `email` is provided in the body, the endpoint interprets this as an attempt to set the email address on a constituent, which makes the email address and type properties required. The response body should also indicate that “The address field is required" (for example).

    I take it that you are writing code to import multiple constituents as part of some automation/job? Are you able to exclude `email` from your request when your reference constituent does not have one? Depending on how your code is organized and what language you're writing in, this may involve explicitly performing that email check (if the email address is “blank”) and setting `email` to null. Depending on how your code serializes that request body to JSON, setting `email` to null should make your request effectively look the same as your working example. If you are manually building that JSON yourself, you may have to account for this on your own.

  • Thanks for the input, Chris.

    It looks like deleting empty object properties works.

Categories