Difference between revisions of "API: Extension Databases"
(→Multiple Record Extension Databases: Reading) |
(→Making Extension Databases available to the API) |
||
(16 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
=Making Extension Databases available to the API= | =Making Extension Databases available to the API= | ||
− | + | This needs enabling in the web application. On the [[Extension_Database_Setup|Extension Database]] record, set Allow API Access to Yes, and an API name will be generated. You might want to change this if you are working with multiple organisations and want to standardise things. Individual fields need enabling to, which can be done in the same way, by clicking on each field, or click Generate API Names on the fields list to enable them all at once. | |
+ | |||
+ | [[File:Extension_Database_Enable_API.png]] | ||
=Single Record Extension Database: Reading= | =Single Record Extension Database: Reading= | ||
Line 18: | Line 20: | ||
=Multiple Record Extension Databases: Reading= | =Multiple Record Extension Databases: Reading= | ||
− | Multiple record extension databases work as their own entity | + | Multiple record extension databases work as their own entity. |
− | [ | + | [GET] https<nowiki/>://api.dizions.co.uk/v2/extension_database/wellcheck_notes |
− | |||
To make things more efficient, you can specify which fields to select: | To make things more efficient, you can specify which fields to select: | ||
Line 34: | Line 35: | ||
=Multiple Record Extension Databases: Creating= | =Multiple Record Extension Databases: Creating= | ||
− | To create a new record you need to do a [ | + | To create a new record you need to do a [POST] request. |
− | [ | + | [POST] https<nowiki/>://api.dizions.co.uk/v2/extension_database/staff_disciplinary |
Then add the body: | Then add the body: | ||
Line 50: | Line 51: | ||
To update a record you also need to supply the ID: | To update a record you also need to supply the ID: | ||
− | [ | + | [PUT] https<nowiki/>://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. | Then add the POST body in the same way as a PUT request. | ||
=Dictionaries= | =Dictionaries= | ||
− | For Extension Database which are " | + | There is not currently a dictionary to see all available Extension Databases, but a call to a non-existent field dictionary will return the list of Extension Databases in the resulting error message: |
+ | [GET] https<nowiki/>://api.dizions.co.uk/v2/dictionary/extension_database/foo | ||
+ | |||
+ | For Extension Database fields which are list, e.g. "Drop-down" or "Radio buttons", there is a dictionary for each field, using the collaboration name displayed on each Extension Database Field: | ||
[GET] https<nowiki/>://api.dizions.co.uk/v2/dictionary/extension_database/INSERT_API_COLLABORATION_NAME_HERE | [GET] https<nowiki/>://api.dizions.co.uk/v2/dictionary/extension_database/INSERT_API_COLLABORATION_NAME_HERE | ||
---- | ---- |
Latest revision as of 08:18, 13 September 2024
Contents
Making Extension Databases available to the API
This needs enabling in the web application. On the Extension Database record, set Allow API Access to Yes, and an API name will be generated. You might want to change this if you are working with multiple organisations and want to standardise things. Individual fields need enabling to, which can be done in the same way, by clicking on each field, or click Generate API Names on the fields list to enable them all at once.
Single Record Extension Database: Reading
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.
To see a full list of standard and single-record Extension Database fields, use the /clients/selectable_fields for Organisation & People-linked records, and the /referrals/selectable_fields for referral-linked records. Club&Clinic-linked Extension Databases are not currently available.
Single Record Extension Database: Writing
Because these are treated the same as the standard fields, they can be posted along with standard fields to /clients or /referrals. Club&Clinic-linked Extension Databases are not currently available.
Multiple Record Extension Databases: Reading
Multiple record extension databases work as their own entity.
[GET] https://api.dizions.co.uk/v2/extension_database/wellcheck_notes
To make things more efficient, you can specify which fields to select:
[GET] https://api.dizions.co.uk/v2/extension_database/wellcheck_notes/field/assessment_score;finances
Filters can be used in the same way as other requests. This gets all results for a particular referral:
[GET] https://api.dizions.co.uk/v2/extension_database/wellcheck_notes/referral/2289
Multiple Record Extension Databases: Creating
To create a new record you need to do a [POST] request.
[POST] https://api.dizions.co.uk/v2/extension_database/staff_disciplinary
Then add the body:
"referral": "2289",
"date_43": "2018-11-08",
The ID of the new record will be returned.
Multiple Record Extension Databases: Updating
To update a record you also need to supply the ID:
[PUT] 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
There is not currently a dictionary to see all available Extension Databases, but a call to a non-existent field dictionary will return the list of Extension Databases in the resulting error message:
[GET] https://api.dizions.co.uk/v2/dictionary/extension_database/foo
For Extension Database fields which are list, e.g. "Drop-down" or "Radio buttons", there is a dictionary for each field, using the collaboration name displayed on each Extension Database Field:
[GET] https://api.dizions.co.uk/v2/dictionary/extension_database/INSERT_API_COLLABORATION_NAME_HERE