-
Notifications
You must be signed in to change notification settings - Fork 81
Parties API
This document outlines the API design for organization project parties. Follows spatial units and organizations API docs.
GET /organizations/{organization-slug}/projects/{project-slug}/parties
Accept: application/json
Content-Type: application/json
Authorization: Token 1398dojk9sd8jf9hsd89hd
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"id": "0asjij9asjd8jh8ghashgd7",
"name": "Barnabas Mughongo",
"type": "IN",
"organization": "Cadasta",
"country": "Uganda"
"description: "",
"archived": false,
"contacts": [ // following http://microformats.org/wiki/h-card
{
"type": ["hcard"],
"properties": {
"name": ["Barnabas Mughongo"],
"email": ["mailto:[email protected]"]
}
}
],
"attributes": [
"depends on party type"
]
"relationships":[],
"tenure_relationships": [],
},
...
]
Providing a query for parameter search will return a list of parties where name, relationship or related parties match the provided query.
GET /organizations/{organization-slug}/projects/{project-slug}/parties/?search=Mughongo
Accept: application/json
Content-Type: application/json
Authorization: Token 1398dojk9sd8jf9hsd89hd
Providing a query for parameter type will return a list of parties that match the given party type.
GET /organizations/{organization-slug}/projects/{project-slug}/parties/?type=IN
Accept: application/json
Content-Type: application/json
Authorization: Token 1398dojk9sd8jf9hsd89hd
Orders the response according to name.
GET /organizations/{organization-slug}/projects/{project-slug}/parties/?ordering=name
For descending ordering add add a dash to the ordering attribute
GET /organizations/{organization-slug}/projects/{project-slug}/parties/?ordering=-name
When the request content contains invalid data
HTTP/1.1 400 Bad request
Content-Type: application/json
{
"name": "This field is required"
}
When the request is not signed with a auth token
HTTP/1.1 401 Unauthorized
Content-Type: application/json
{
"error": "Please sign in."
}
The request Content-Type
must be multipart/formdata
to allow
uploading files together with other form data.
POST /organizations/{organization-slug}/projects/{project-slug}/parties/
Content-Type: multipart/formdata
Authorization: Token 1398dojk9sd8jf9hsd89hd
---separator---
Content-Disposition: form-data; name="name"
Barnabas Mughongo
---separator---
Content-Disposition: form-data; name="project"
Mapping property rights in Uganda
---separator---
---separator---
Content-Disposition: form-data; name="type"
IN
Content-Disposition: form-data; name="contacts"
{}
---separator---
Content-Disposition: form-data; name="attributes"
{}
---separator---
Content-Disposition: form-data; name="relationships"
[]
---separator---
HTTP/1.1 201 Created
Content-Type: application/json
[
{
"id": "0asjij9asjd8jh8ghashgd7",
"name": "Barnabas Mughongo",
"type": "Individual",
"organization": "",
"country": "Uganda"
"description: "",
"archived": false,
"contacts": [],
"attributes": [
"depends on party type"
]
"relationships":[],
"tenure_relationships": [],
},
...
]
GET /organizations/{organization-slug}/projects/{project-slug}/parties/0asjij9asjd8jh8ghashgd7
Accept: application/json
Content-Type: application/json
Authorization: Token 1398dojk9sd8jf9hsd89hd
{
"id": "0asjij9asjd8jh8ghashgd7",
"name": "Barnabas Mughongo",
"type": "Individual",
"organization": "",
"country": "Uganda"
"description: "",
"archived": false,
"contacts": [],
"attributes": [
"depends on party type"
]
"relationships":[],
"tenure_relationships": [],
}
Request
The request Content-Type
must be multipart/formdata
to allow
uploading files together with other form data.
PATCH /organizations/{organization-slug}/projects/{project-slug}/parties/0asjij9asjd8jh8ghashgd7
Content-Type: multipart/formdata
Authorization: Token 1398dojk9sd8jf9hsd89hd
---separator---
Content-Disposition: form-data; name="name"
Barnabas Mughongo
---separator---
Content-Disposition: form-data; name="project"
Mapping property rights in Uganda
---separator---
---separator---
Content-Disposition: form-data; name="type"
IN
Content-Disposition: form-data; name="contacts"
[
{
"type": ["hcard"],
"properties": {
"name": ["Barnabas Mughongo"],
"email": ["mailto:[email protected]"]
}
}
]
---separator---
Content-Disposition: form-data; name="attributes"
{
"gender": "Male",
"dob": "1980-02-11",
"notes": "Brother to Solomon Mughongo"
}
---separator---
Content-Disposition: form-data; name="relationships"
[]
---separator---
HTTP/1.1 200 Ok
Content-Type: application/json
[
{
"id": "0asjij9asjd8jh8ghashgd7",
"name": "Barnabas Mughongo",
"type": "IN",
"organization": "",
"country": "Uganda"
"description: "",
"archived": false,
"contacts": [
{
"type": ["hcard"],
"properties": {
"name": ["Barnabas Mughongo"],
"email": ["mailto:[email protected]"]
}
}
],
"attributes": {
"gender": "Male",
"dob": "1980-02-11",
"notes": "Brother to Solomon Mughongo"
},
"relationships":[],
"tenure_relationships": [],
},
...
]
Visit our User Documentation to learn more about using the Cadasta Platform.
If you'd like to contribute to the Cadasta Platform, start with our Contributing Guidelines.
Cadasta Wiki Home | Developer Setup Guide
Cadasta.org | About Cadasta | YouTube | Twitter | Facebook
- Installing & Running
- Contributing
- Planning & Sprints
- Platform Development
- Testing
- Utilities
- Outreachy
- Platform Site Map
- User Flows and Wireframes
- Other
- Quick Start Guide
- Glossary
- Questionnaire Guide