1. List Permissions
  2. Add Permission
  3. Remove Permission

/permissions

List Permissions

URL: /resources/{resource_id}/permissions.json

Method: GET

Protocol: HTTP, HTTPS

Parameters:

  • resource_id – resource ID of the map/layer/datasource

Returns one of:

  • 200 (OK) + collection of permissions
  • 404 (Not Found)

This URL path uses a resource_id parameter.
All resources that can be shared (maps, layers, datasources etc.) have their own unique resource ID.
Resource ID for e.g. a map can be checked using /maps/{map_id}
Resource ID of a map is not to be confused with map ID.

Example of listing permissions for a map with resource id ‘618’:

curl -X POST https://api.giscloud.com/1/resources/618/permissions.json

Data returned:

{
    "type": "permissions",
    "total": 0,
    "page": 1,
    "data": [
        {
            "permissions": [
                {
                    "type": "READ",
                    "share_id": "657"
                }
            ],
            "username": "anonymous"
        },
        {
            "permissions": [
                {
                    "type": "OWNER",
                    "share_id": "655"
                }
            ],
            "username": "gc_user"
        }
    ]
}

Please note “share_id” value under “permissions”, this ID is used in delete permission requests.

Add Permission

URL: /resources/{resource_id}/permissions

Method: POST

Protocol: HTTPS

Parameters:

  • resource_id – ID of the map/layer/datasource

Returns:

  • 201 (Created)

Data is sent in body in JSON format, e.g.

{
    "username": "gc_user",
    "permission": "READ";
}

Example of sharing a map with resource ID ‘618’ to user ‘gc_user’ with permission ‘READ’:

curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"username": "gc_user", "permission": "READ"}' \
  https://api.giscloud.com/1/resources/618/permissions

Here’s a list of all available permissions:

    READ
    EDIT
    EXPORT
    EDIT_WITH_SHARE
    INSERT
    INSERT_MDC
    UPDATE
    UPDATE_MDC
    DELETE
    DELETE_MDC
    SHARE

Remove Permission

URL: /resources/{resource_id}/permissions/{share_id}

Method: DELETE

Protocol: HTTPS

Parameters:

  • resource_id – ID of the map/layer/datasource
  • share_id – ID of specific permission for resource

Returns:

  • 204 (No Content) if successful
  • 404 if the resource wasn’t found

Example of deleting permission with share ID ‘655’ from resource with ID ‘618’:

curl -X DELETE https://api.giscloud.com/1/resources/618/permissions/655

Share ID can be checked with List Permissions.