API: Extension Databases

From Charitylog Manual
Revision as of 13:49, 26 August 2020 by Msim (talk | contribs)
Jump to: navigation, search

Go to API overview

Helpheader small.png

Making Extension Databases available to the API

You can choose which Extension Database fields are exposed to the API, by editing the field in the web application. Set "Allow collaborator API access?" to "Yes", at which point a "Name to share with collaborators" (field name) will be generated. You can then reference that extension database field in the API by the collaborator name.


Single Record Extension Databases

For the API consumer, these are treated the same as the standard fields. For example, an API consumer selecting field/postcode;show_size;ethnicity does not need to know that postcode and ethinicity are standard fields, and shoe_size is an Extension Database field.

Multiple Record Extension Databases [GET]

Multiple record extension databases work as their own entity. They can be accessed in the API by a combination of their name and ID. Convert the name to lowercase, and replace spaces with underscores. Then separate the name and ID with an underscore. For example, this end point that gets all records for extension database 13, called Staff Disciplinary:

[GET] https://api.dizions.co.uk/v2/extension_database/staff_disciplinary_13

You can also specify which fields you want to select, to make things more efficient. Extension database records can be filtered in the same way as other requests, to get all results for a particular referral you can do this:

[GET] https://api.dizions.co.uk/v2/extension_database/wellcheck_notes_9/referral/2289

Multiple Record Extension Databases [PUT]

To create a new record you need to do a [PUT] request.

[PUT] https://api.dizions.co.uk/v2/extension_database/staff_disciplinary_13

Then add the body:

referral 2289

date_43 2018-11-08

The ID of the new record will be returned.

Multiple Record Extension Databases [POST]

To update a record you also need to supply the ID:

[POST] https://api.dizions.co.uk/v2/extension_database/wellcheck_notes_9/id/17 Then add the POST body in the same way as a PUT request.

Dictionaries

For Extension Database which are "Select From Option List" or "Radio buttons", there is a dictionary for each field, using the collaboration name displayed on each Extension Database Field: https://api.dizions.co.uk/v2/dictionary/extension_database/INSERT_API_COLLABORATION_NAME_HERE