GET /rest/unit/:unitPUT /rest/unit/:unitGET /rest/unit/:unit/contactsGET /rest/unit/:unit/pagelogGET /rest/unit/:unit/membersGET /rest/contact/:phone_numberPUT /rest/contact/:phone_numberGET /rest/member/:member_idPUT /rest/member/:member_idGET /rest/role/:name
Used to get details on the specified unit.
URL: /rest/unit/:unit
Method: GET
Permissions required: own unit or unit-read
URL Params: unit = string, valid unit name
Code: 200 OK
Content example
{
"name": "Bellarine",
"capcode": 10102
}Condition: If unit could not be found
Code: 404 Not Found
Condition: If user has insufficient permissions
Code: 403 Forbidden
Used to edit or create the specified unit.
URL: /rest/unit/:unit
Method: PUT
Permissions required: (own unit and myunit-unit-write) or unit-write
URL Params: unit = string, valid unit name
Data constraints
{
"capcode": integer, required
}Data example
{
"capcode": 10102
}Code: 200 OK
Code: 201 Created
Content example
{
"name": "Bellarine",
"capcode": 10102
}Condition: If user has insufficient permissions
Code: 403 Forbidden
Condition: If data did not validate
Code: 422 Unprocessable Entity
Used to get the contacts for a given unit.
URL: /rest/unit/:unit/contacts
Method: GET
Permissions required: (own unit and myunit-contact-read) or contact-read
URL Params: unit = string, valid unit name
Code: 200 OK
Content example
[
{
"phone_number": "61402123123",
"unit": "Bellarine",
"member_id": 612
},
{
"phone_number": "61567321321",
"unit": "Bellarine",
"member_id": 787
}
}Condition: If unit could not be found
Code: 404 Not Found
Condition: If user has insufficient permissions
Code: 403 Forbidden
Used to get the log of pages for a given unit.
URL: /rest/unit/:unit/pagelog
Method: GET
Permissions required: (own unit and myunit-pagelog-read) or pagelog-read
URL Params: unit = string, valid unit name
Code: 200 OK
Content example
[
{
"unit": "Bellarine",
"timestamp": 1509703002.2548757,
"phone_number": "61402123123",
"body": "S171030602 BELL - ANIMAL INCIDENT - DOG TRAPPED IN A WELL - CLIFTON SPRINGS GOLF CLUB M 456 J5 FRED SMITH 0412123123 [BELL]"
},
{
"unit": "Bellarine",
"timestamp": 1509703183.9556262,
"phone_number": "61422321123",
"body": "Reminder to send through Map & Navigation Course Nominations for 24,25,26 November - Bannockburn [S_W_INFO]"
}
}Condition: If unit could not be found
Code: 404 Not Found
Condition: If user has insufficient permissions
Code: 403 Forbidden
Used to get the list of members for a given unit.
URL: /rest/unit/:unit/members
Method: GET
Permissions required: (own unit and myunit-member-read) or member-read
URL Params: unit = string, valid unit name
Code: 200 OK
Content example
[
{
"member_id": 60012,
"name": "John Member",
"unit": "Bellarine",
"roles": ["site-admin"]
},
{
"member_id": 67021,
"name": "Valerie Smith",
"unit": "Bellarine",
"roles": ["contact-maintainer"]
}
}Condition: If unit could not be found
Code: 404 Not Found
Condition: If user has insufficient permissions
Code: 403 Forbidden
Used to get details on the specified contact.
URL: /rest/contact/:phone_number
Method: GET
Permissions required: (own unit and myunit-contact-read) or contact-read
URL Params: phone_number = string, existing phone number
Code: 200 OK
Content example
{
"phone_number": "61402123123",
"unit": "Bellarine",
"member_id": 612
}Condition: If contact could not be found
Code: 404 Not Found
Condition: If user has insufficient permissions
Code: 403 Forbidden
Used to edit or create the specified contact.
URL: /rest/contact/:phone_number
Method: PUT
Permissions required: (own unit and myunit-contact-write) or contact-write
URL Params: phone_number = string, valid international mobile number
Data constraints
{
"unit": string, existing unit, required,
"member_id": integer, required
}Data example
{
"unit": "Bellarine",
"member_id": 612
}Code: 200 OK
Code: 201 Created
Content example
{
"phone_number": "61402123123",
"unit": "Bellarine",
"member_id": 612
}Condition: If user has insufficient permissions
Code: 403 Forbidden
Condition: If data did not validate
Code: 422 Unprocessable Entity
Used to get details on the specified member.
URL: /rest/member/:member_id
Method: GET
Permissions required: (own unit and myunit-member-read) or member-read
URL Params: member_id = integer, existing member id
Code: 200 OK
Content example
{
"member_id": 60012,
"name": "Jane Member",
"unit": "Bellarine",
"roles": ["site-admin"]
}Condition: If member could not be found
Code: 404 Not Found
Condition: If user has insufficient permissions
Code: 403 Forbidden
Used to edit or create the specified member.
URL: /rest/member/:member_id
Method: PUT
Permissions required: (own unit and myunit-member-write) or member-write
URL Params: member_id = integer, existing member id
Data constraints
{
"name": string, required,
"unit": string, existing unit, required,
"roles": json list of strings, existing roles, required
}Data example
{
"name": "Jane Member",
"unit": "Bellarine",
"roles": ["site-admin"]
}Code: 200 OK
Code: 201 Created
Content example
{
"member_id": 60012,
"name": "Jane Member",
"unit": "Bellarine",
"roles": ["site-admin"]
}Condition: If user has insufficient permissions
Code: 403 Forbidden
Condition: If data did not validate
Code: 422 Unprocessable Entity
Used to get details on the specified role.
URL: /rest/role/:name
Method: GET
Permissions required: None
URL Params: name = string
Code: 200 OK
Content example
{
"name": "site-admin",
"permissions": ["pagelog-read", "member-write"]
}Condition: If role could not be found
Code: 404 Not Found