Getting staff permissions¶
Account can have full or limited access to a venue. Those permissions are defined by roles - assigned to a project (and used for every venue of a project) or to a specific venue.
Listing venue roles¶
You can get all accounts with access to given venue by using venue-roles endpoint that returns a list of venue roles:
GET /core/venue-roles/?filter[venue]=VENUE_ID
curl \
-H "Authorization: Bearer ${API_TOKEN}" \
-H "Accept: application/vnd.api+json" \
"https://api.socialwifi.com/core/venue-roles/?filter\[venue\]=VENUE_ID_HERE" \
| jq
Response
{
"data": [
{
"type": "venue-roles",
"id": "44444444-4444-4444-4444-444444444444",
"attributes": {
"name": "owner",
"inherited-from": "project-roles",
"permissions": [
"basic_data.read",
"basic_data.list",
"venues.read",
"venues.list",
"venues.create",
"venues.update",
"venues.destroy",
"venues.roles.read",
"venues.roles.list",
"venues.roles.create",
"venues.roles.update",
"venues.roles.destroy",
"venues.messages.read",
"venues.messages.list",
"venues.messages.create",
"venues.messages.update",
"venues.messages.destroy"
]
},
"relationships": {
"venue": {
"data": {
"type": "venues",
"id": "22222222-2222-2222-2222-222222222222"
}
},
"account": {
"data": {
"type": "accounts",
"id": "99999999-9999-9999-9999-999999999999"
}
}
}
}
],
"meta": {
"count": 1
},
"jsonapi": {
"version": "1.0"
}
}
Listing project roles¶
If you want to list only project level roles for your project you can do it like so:
GET /core/project-roles/?filter[project]=PROJECT_ID
curl \
-H "Authorization: Bearer ${API_TOKEN}" \
-H "Accept: application/vnd.api+json" \
https://api.socialwifi.com/core/project-roles/?filter[project]=PROJECT_ID_HERE \
| jq
Response
{
"data": [
{
"type": "project-roles",
"id": "55555555-5555-5555-5555-555555555555",
"attributes": {
"name": "reader",
"permissions": [
"basic_data.read",
"basic_data.list",
"projects.read",
"projects.list",
"projects.create",
"projects.roles.read",
"projects.roles.list"
]
},
"relationships": {
"project": {
"data": {
"type": "projects",
"id": "11111111-1111-1111-1111-111111111111"
}
},
"account": {
"data": {
"type": "accounts",
"id": "66666666-6666-6666-6666-666666666666"
}
}
}
},
{
"type": "project-roles",
"id": "44444444-4444-4444-4444-444444444444",
"attributes": {
"name": "owner",
"permissions": [
"basic_data.read",
"basic_data.list",
"projects.read",
"projects.list",
"projects.create",
"projects.update",
"projects.destroy",
"projects.roles.read",
"projects.roles.list",
"projects.roles.create",
"projects.roles.update",
"projects.roles.destroy"
]
},
"relationships": {
"project": {
"data": {
"type": "projects",
"id": "11111111-1111-1111-1111-111111111111"
}
},
"account": {
"data": {
"type": "accounts",
"id": "99999999-9999-9999-9999-999999999999"
}
}
}
}
],
"meta": {
"count": 2
},
"jsonapi": {
"version": "1.0"
}
}
Info
venue-roles inherit project-roles, so you don't have to manually
combine those lists if you want to know who has specific venue access.
A role object contains permissions attribute containing a list of "actions" given account can do. From simple read to various create/delete/update actions on project or venue.
Fetching account details¶
To fetch details about accounts having the ID from roles you can use /filtered-accounts/ endpoint and comma delimited list of account IDs:
GET /accounts/filtered-accounts/?filter[id][in]=ACCOUNT_ID,ACCOUNT_ID
curl \
-H "Authorization: Bearer ${API_TOKEN}" \
-H "Accept: application/vnd.api+json" \
https://api.socialwifi.com/accounts/filtered-accounts/?filter[id][in]=ACCOUNT_ID,ACCOUNT_ID,... \
| jq
Response
{
"data": [
{
"type": "accounts",
"id": "99999999-9999-9999-9999-999999999999",
"attributes": {
"tags": [],
"email": "john.doe@socialwifi.com",
"roles-names": [
"STANDARD"
],
"full-name": "John Doe",
"confirmed-at": "2012-06-29T20:38:56+00:00",
"language": "en",
"created-by-id": null
}
},
{
"type": "accounts",
"id": "66666666-6666-6666-6666-666666666666",
"attributes": {
"tags": [],
"email": "jane.doe@socialwifi.com",
"roles-names": [
"ADMIN"
],
"full-name": "Jane Doe",
"confirmed-at": "1985-12-17T23:07:48+00:00",
"language": "en",
"created-by-id": null
}
}
],
"meta": {
"count": 2
},
"jsonapi": {
"version": "1.0"
}
}
You can also fetch details of one account by using its ID:
GET /accounts/filtered-accounts/ACCOUNT_ID/
curl \
-H "Authorization: Bearer ${API_TOKEN}" \
-H "Accept: application/vnd.api+json" \
https://api.socialwifi.com/accounts/filtered-accounts/ACCOUNT_ID/ \
| jq
Response
{
"data": {
"type": "accounts",
"id": "99999999-9999-9999-9999-999999999999",
"attributes": {
"email": "john.doe@socialwifi.com",
"full-name": "John Doe",
"confirmed-at": "2012-06-29T20:38:56+00:00",
"language": "en",
"roles-names": [
"STANDARD"
],
"tags": [],
"created-by-id": null
}
},
"jsonapi": {
"version": "1.0"
}
}
Fetching own account details¶
Instead of using account ID you can use a special identifier me to fetch details of
the account that is making the API request:
GET /accounts/filtered-accounts/me/
curl \
-H "Authorization: Bearer ${API_TOKEN}" \
-H "Accept: application/vnd.api+json" \
https://api.socialwifi.com/accounts/filtered-accounts/me/ \
| jq
Response
{
"data": {
"type": "accounts",
"id": "99999999-9999-9999-9999-999999999999",
"attributes": {
"email": "john.doe@socialwifi.com",
"full-name": "John Doe",
"confirmed-at": "2012-06-29T20:38:56+00:00",
"language": "en",
"roles-names": [
"STANDARD"
],
"tags": [],
"created-by-id": null
}
},
"jsonapi": {
"version": "1.0"
}
}