API: External Referrals

From Charitylog Manual
Revision as of 15:45, 17 February 2020 by Msim (talk | contribs)
Jump to: navigation, search
Helpheader small.png

External Referrals are an alterative to making clients and referrals directly: they are held in a staging area, to be imported or rejected by the system administrator. This has the advantage that the caller of the API does not need to check whether the client they have is already known - the administrator can use the search tools in the GUI to prevent duplicates.


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

The org_type_id, surname and description fields must be passed as a minimum. Most optional fields are any field from the client endpoint, with 1 notable exception: project. Including project will save the user who processes the referrals from having to select it each time they import.


Multiple people can be sent in one PUT, for instance a carer and their cared-fors, or a client and their social worker. In both cases, it may be useful to specify the relationships between them. The key-values for the relationship can be found in the dictionary. In the example below, Alice is the mother (relationship 5 in our demo system) of Bob and Charlie. Bob and Charlie are the sons (relationship 8) of Alice. Bob and Charlie are brothers (relationship 15). The people are referenced by a zero-indexed list, e.g. Alice is 0, with a relationship to 1 (Bob) and 2 (Charlie).

   [
   [
       'first_name' => 'Alice',
       'surname' => 'Smith',
       'org_type_id' => '1',
       'relationships' => [
           1 => 5
           2 => 5
       ]
   ],
   [
       'first_name' => 'Bob',
       'surname' => 'Smith',
       'org_type_id' => '2',
       'relationships' => [
           0 => 8
           2 => 15
       ]
   ],
   [
       'first_name' => 'Charlie',
       'surname' => 'Smith',
       'org_type_id' => '2',
       'relationships' => [
           0 => 8
           1 => 15
       ]
   ]
   ]

Relationships are optional, but if specified, they must be in pairs. For instance, it is not possible to specify Bob as the son, without also specifying Alice as the mother.

Carer relationships can also be set, using the key carer_relationships.