Difference between revisions of "API relationships"
From Charitylog Manual
Line 5: | Line 5: | ||
[PUT] https<nowiki/>://api.dizions.co.uk/v2/clients/relationship_details/set/37/59 | [PUT] https<nowiki/>://api.dizions.co.uk/v2/clients/relationship_details/set/37/59 | ||
− | Put the relationships in the body, and optionally whether the relationship is a major relationship. To get a list of relationships, use the dictionary: | + | Put the relationships in the body, and optionally whether the relationship is a major relationship. |
+ | |||
+ | [ | ||
+ | { | ||
+ | "relation_first_to_second": "6", | ||
+ | "relation_second_to_first": "5", | ||
+ | "major": "Y" | ||
+ | } | ||
+ | ] | ||
+ | |||
+ | To get a list of relationships, use the dictionary: | ||
[GET] https<nowiki/>://api.dizions.co.uk/v2/dictionary/relationships | [GET] https<nowiki/>://api.dizions.co.uk/v2/dictionary/relationships | ||
+ | Carer relationships can be created in the same way: | ||
[ | [ | ||
{ | { | ||
"relation_first_to_second": "6", | "relation_first_to_second": "6", | ||
"relation_second_to_first": "5", | "relation_second_to_first": "5", | ||
− | " | + | "carer_relation_first_to_second": "1", |
+ | "carer_relation_second_to_first": "2", | ||
+ | } | ||
+ | ] | ||
+ | NB, if the carer relationship is specified, the "standard" relationship must be specified as well, i.e. this is not valid: | ||
+ | [ | ||
+ | { | ||
+ | "carer_relation_first_to_second": "1", | ||
+ | "carer_relation_second_to_first": "2", | ||
} | } | ||
] | ] | ||
+ | |||
+ | To get a list of relationships, use the dictionary: | ||
+ | |||
+ | [GET] https<nowiki/>://api.dizions.co.uk/v2/dictionary/carer_relationships |
Revision as of 14:22, 11 September 2020
Relationships are created using the clients endpoint, passing the id numbers of the 2 clients in the URL. An example call to create a relatiionship between person 37 and person 59 would look like:
[PUT] https://api.dizions.co.uk/v2/clients/relationship_details/set/37/59
Put the relationships in the body, and optionally whether the relationship is a major relationship.
[ { "relation_first_to_second": "6", "relation_second_to_first": "5", "major": "Y" } ]
To get a list of relationships, use the dictionary:
[GET] https://api.dizions.co.uk/v2/dictionary/relationships
Carer relationships can be created in the same way:
[ { "relation_first_to_second": "6", "relation_second_to_first": "5", "carer_relation_first_to_second": "1", "carer_relation_second_to_first": "2", } ]
NB, if the carer relationship is specified, the "standard" relationship must be specified as well, i.e. this is not valid:
[ { "carer_relation_first_to_second": "1", "carer_relation_second_to_first": "2", } ]
To get a list of relationships, use the dictionary:
[GET] https://api.dizions.co.uk/v2/dictionary/carer_relationships