Difference between revisions of "API: Selecting Specific Fields"
(→IDs or names?) |
|||
Line 5: | Line 5: | ||
When you hit an endpoint, a range of default fields are automatically returned. If you want something that isn't default, or you want to return less data to speed things up, you can pick the fields to be returned. In the case of referrals or clients you can also return any single record extension databases. Use /field/ with semicolon separated field names to choose the fields you want to return. | When you hit an endpoint, a range of default fields are automatically returned. If you want something that isn't default, or you want to return less data to speed things up, you can pick the fields to be returned. In the case of referrals or clients you can also return any single record extension databases. Use /field/ with semicolon separated field names to choose the fields you want to return. | ||
− | [GET] https<nowiki/>://api.dizions.co.uk/clients/field/id;surname;website_photo_consent | + | [GET] https<nowiki/>://api.dizions.co.uk/clients/field/id;surname;website_photo_consent |
The API can tell you which fields are available by appending /selectable_fields to the group. | The API can tell you which fields are available by appending /selectable_fields to the group. | ||
− | [GET] https<nowiki/>://api.dizions.co.uk/v2/clients/selectable_fields | + | [GET] https<nowiki/>://api.dizions.co.uk/v2/clients/selectable_fields |
− | [GET] https<nowiki/>://api.dizions.co.uk/v2/workers/selectable_fields | + | [GET] https<nowiki/>://api.dizions.co.uk/v2/workers/selectable_fields |
− | [GET] https<nowiki/>://api.dizions.co.uk/v2/referrals/selectable_fields | + | [GET] https<nowiki/>://api.dizions.co.uk/v2/referrals/selectable_fields |
− | [GET] https<nowiki/>://api.dizions.co.uk/v2/due_contacts/selectable_fields | + | [GET] https<nowiki/>://api.dizions.co.uk/v2/due_contacts/selectable_fields |
− | [GET] https<nowiki/>://api.dizions.co.uk/v2/done_contacts/selectable_fields | + | [GET] https<nowiki/>://api.dizions.co.uk/v2/done_contacts/selectable_fields |
− | [GET] https<nowiki/>://api.dizions.co.uk/v2/schedules/selectable_fields | + | [GET] https<nowiki/>://api.dizions.co.uk/v2/schedules/selectable_fields |
---- | ---- | ||
Line 26: | Line 26: | ||
For read-only applications, e.g. a reporting dashboard, it may be useful to ask the API for the names of options, instead of the IDs, e.g. "Private Rented" instead of "4" for accommodation. The is referred to as "resolving" the IDs. You can specify individual fields, like this: | For read-only applications, e.g. a reporting dashboard, it may be useful to ask the API for the names of options, instead of the IDs, e.g. "Private Rented" instead of "4" for accommodation. The is referred to as "resolving" the IDs. You can specify individual fields, like this: | ||
− | v2/clients/id/1/field/id;ethnicity;main_language;school/?resolveIds[]=ethnicity&resolveIds[]=main_language | + | v2/clients/id/1/field/id;ethnicity;main_language;school/?resolveIds[]=ethnicity&resolveIds[]=main_language |
Line 32: | Line 32: | ||
− | v2/clients/id/1/field/id;ethnicity;main_language;school/?resolveIds[]=ALL | + | v2/clients/id/1/field/id;ethnicity;main_language;school/?resolveIds[]=ALL |
NB this only applies when GETing data, records must always be created and updated using IDs. | NB this only applies when GETing data, records must always be created and updated using IDs. |
Revision as of 15:21, 26 August 2020
When you hit an endpoint, a range of default fields are automatically returned. If you want something that isn't default, or you want to return less data to speed things up, you can pick the fields to be returned. In the case of referrals or clients you can also return any single record extension databases. Use /field/ with semicolon separated field names to choose the fields you want to return.
[GET] https://api.dizions.co.uk/clients/field/id;surname;website_photo_consent
The API can tell you which fields are available by appending /selectable_fields to the group.
[GET] https://api.dizions.co.uk/v2/clients/selectable_fields
[GET] https://api.dizions.co.uk/v2/workers/selectable_fields
[GET] https://api.dizions.co.uk/v2/referrals/selectable_fields
[GET] https://api.dizions.co.uk/v2/due_contacts/selectable_fields
[GET] https://api.dizions.co.uk/v2/done_contacts/selectable_fields
[GET] https://api.dizions.co.uk/v2/schedules/selectable_fields
IDs or names?
For read-only applications, e.g. a reporting dashboard, it may be useful to ask the API for the names of options, instead of the IDs, e.g. "Private Rented" instead of "4" for accommodation. The is referred to as "resolving" the IDs. You can specify individual fields, like this:
v2/clients/id/1/field/id;ethnicity;main_language;school/?resolveIds[]=ethnicity&resolveIds[]=main_language
or all fields, like this:
v2/clients/id/1/field/id;ethnicity;main_language;school/?resolveIds[]=ALL
NB this only applies when GETing data, records must always be created and updated using IDs.