Skip to main content

Save Reason

Systems can create or update reason details within the Donary system by using the Save Reason API.


Endpoint

/V1/External/SaveReason

Http Request Method

PUT

Request Header

APIKey - The API key for authorization.

Request Body

note

* Indicates required field.
* Provide if updating a reason.
* Either reasonName or reasonNameHebrew is required.

NameTypeDescription
orgGuid *stringOrganization's unique identifier.
reasonNumber *intReason number. If a valid ID is provided, the existing reason will be updated. Click here for more information on this field.
reasonName *stringReason English name.
reasonNameHebrew *stringReason Hebrew name.
homePhoneNumber stringHome phone number associated with the reason.
cellPhoneNum stringCell phone number associated with the reason.
email stringEmail address associated with the reason.
campaignNum intOptional campaign number to lock the reason to a specific campaign. If the campaign does not exist for the organization, the API returns an error.

Validation Notes

  • campaignNum is optional.
  • When campaignNum is provided, it must belong to an existing campaign in the organization.
  • If the campaign is invalid, the API returns HTTP 400 with the message CampaignNum is invalid.

Response

See list of possible errors.


Create Reason Example:

This example will create a new reason and return the reasonNumber, 1001.

note

A new reason will be created in this example because reasonNumber is set to zero, which is not a valid id.

cURL:

curl --location --request PUT 'https://webapi.donary.com/V1/External/SaveReason' \
--header 'APIKey: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{"orgGuid":"115e9d3d-baf2-4089-b896-9b2621ffcf1b","reasonNumber":0,"reasonName":"Reason A","reasonNameHebrew":"ריסאן א","homePhoneNumber":"7185551111","cellPhoneNum":"7185552222","email":"reason@example.com","campaignNum":1001}'

Payload:

{
"orgGuid": "115e9d3d-baf2-4089-b896-9b2621ffcf1b",
"reasonNumber": 0,
"reasonName": "Reason A",
"reasonNameHebrew": "ריסאן א",
"homePhoneNumber": "7185551111",
"cellPhoneNum": "7185552222",
"email": "reason@example.com",
"campaignNum": 1001
}

Response:

{
"orgGuid": "115e9d3d-baf2-4089-b896-9b2621ffcf1b",
"reasonNumber": 1001,
"reasonName": "Reason A",
"reasonNameHebrew": "ריסאן א",
"homePhoneNumber": "7185551111",
"cellPhoneNum": "7185552222",
"email": "reason@example.com",
"campaignNum": 1001
}

Update Reason Example:

This example will update Reason 1001's reasonName, reasonNameHebrew, and optional contact details.

note

In order to update a specific reason, the reasonNumber must be included in the payload. Learn more about how to update a record here.

cURL:

curl --location --request PUT 'https://webapi.donary.com/V1/External/SaveReason' \
--header 'APIKey: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{"orgGuid":"115e9d3d-baf2-4089-b896-9b2621ffcf1b","reasonNumber":1001,"reasonName":"Reason B","reasonNameHebrew":"ריסאן ב","homePhoneNumber":"7185553333","cellPhoneNum":"7185554444","email":"updated-reason@example.com","campaignNum":1001}'

Payload:

{
"orgGuid": "115e9d3d-baf2-4089-b896-9b2621ffcf1b",
"reasonNumber": 1001,
"reasonName": "Reason B",
"reasonNameHebrew": "ריסאן ב",
"homePhoneNumber": "7185553333",
"cellPhoneNum": "7185554444",
"email": "updated-reason@example.com",
"campaignNum": 1001
}

Response:

{
"orgGuid": "115e9d3d-baf2-4089-b896-9b2621ffcf1b",
"reasonNumber": 1001,
"reasonName": "Reason B",
"reasonNameHebrew": "ריסאן ב",
"homePhoneNumber": "7185553333",
"cellPhoneNum": "7185554444",
"email": "updated-reason@example.com",
"campaignNum": 1001
}