ServiceRoles

Resource URI

/services/{serviceId}/roles

Items in curly braces represent variables.

Description

Service Roles establish a connection between Services, Roles, and through Roles, Users, and thus determine what a User, or Member of the Developer Portal, can see when interacting with API-related Portal pages such as I/O Docs.

Resource Schema

Property Characteristics
id Type string
Sub-type
Create Rule Ignored
Update Rule Required (if not in context)
Fetch Rule Implicit
Description Object identifier.
created Type string
Sub-type datetime
Create Rule Ignored
Update Rule Ignored
Fetch Rule Implicit
Description Date/time the object was created.
updated Type string
Sub-type datetime
Create Rule Ignored
Update Rule Ignored
Fetch Rule Implicit
Description Date/time the object was updated.
name Type string
Sub-type
Create Rule Required
Update Rule Optional
Fetch Rule Implicit
Description Role name.
action Type string
Sub-type
Create Rule Required
Update Rule Optional
Fetch Rule Implicit
Description Action.

fetch all [GET]

Retrieves the identified Roles for the Service Definition.

Parameters

Parameter Required Type Description
serviceId true string Service identifier.
fields false string Comma-separated list of property paths to include in response. Each property path is a dot-separated list of object property names. fields=<property\[.property...\]>\[,...\]\[&fields=...\]
filter false string Colon-separated name/value pair specifying the name of property whose value must contain the given value (as a substring). Results may also be filtered by nested collections' properties by specifying a dot-separated property path. filter=<property\[.property...\]>:<value>\[&filter=...\]
sort false string Comma-separated list of properties to sort by. Only root-level properties are supported. Each property name may be optionally followed by :asc or :desc to specify sort direction (defaults to asc). sort=<property\[:(asc\|desc)\]>\[,...\]\[&sort=...\]
limit false int Number of objects to return in the result. Defaults to 100.
offset false int 0-based index of first object in the list to return. Defaults to 0.

Returns

Success

Array of Service Roles If fields request parameter is not included, only those fields with "Fetch Rule" equal to "Implicit" will be returned. Otherwise, the fields contained in the URL parameter will be included in the response.

Failure

Array of validation responses

Examples

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/roles' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" 

Response

[
    {
        "id": "1cca2eaf-9c58-499e-9d31-be3433920bea",
        "created": "2013-08-24T03:21:49.000+0000",
        "updated": "2014-05-05T20:15:32.000+0000",
        "name": "ut volutpat",
        "action": "tincidunt in leo maecenas"
    }
]

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/roles' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" 

Response

[
    {
        "id": "0d67203f-d18d-4389-96a7-35d9c01d5cc9",
        "created": "2014-02-02T02:27:31.000+0000",
        "updated": "2013-11-06T09:15:13.000+0000",
        "name": "lacinia",
        "action": "orci luctus et"
    }
]

create [POST]

Assigns Roles to a Service Definition.

Parameters

Parameter Required Type Description
serviceId true string Service identifier.
role true object Role object

Returns

Success

Array of Service Roles If fields request parameter is not included, only those fields with "Fetch Rule" equal to "Implicit" will be returned. Otherwise, the fields contained in the URL parameter will be included in the response.

Failure

Array of validation responses

Examples

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/roles' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request POST --data '{"id":"b0b5d933-6d6b-4dd0-99b4-cc2a3c4cdfee","updated":"2014-01-16T03:28:12.000+0000","created":"2014-03-21T23:49:34.000+0000","name":"ipsum","action":"eu massa donec dapibus"}

Response

[
    {
        "id": "fc2ebd1b-a32c-4fc4-b59a-db2463669b2f",
        "created": "2014-03-14T13:27:12.000+0000",
        "updated": "2014-05-28T19:02:42.000+0000",
        "name": "semper sapien",
        "action": "elit"
    }
]

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/roles' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request POST --data '{"id":"463506ec-3443-402f-a8cc-f8a794a57b0c","updated":"2014-04-07T06:44:50.000+0000","created":"2013-08-13T07:55:10.000+0000","name":"suspendisse potenti nullam porttitor","action":"justo aliquam quis"}

Response

[
    {
        "id": "2200947c-1f4e-4d48-b370-61f8db1ed08e",
        "created": "2013-11-08T18:51:44.000+0000",
        "updated": "2014-05-02T00:19:46.000+0000",
        "name": "dui nec nisi volutpat",
        "action": "in sapien iaculis"
    }
]

update [PUT]

Updates the Roles assigned to the identified Service Definition.

Parameters

Parameter Required Type Description
serviceId true string Service identifier.
serviceRole true object Service Role object

Returns

Success

Array of Service Roles If fields request parameter is not included, only those fields with "Fetch Rule" equal to "Implicit" will be returned. Otherwise, the fields contained in the URL parameter will be included in the response.

Failure

Array of validation responses

Examples

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/roles' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request PUT --data '{"id":"5abeabae-6c10-40f5-b1e2-af6f74bcde94","updated":"2013-10-11T04:45:13.000+0000","created":"2014-06-12T05:27:24.000+0000","name":"at","action":"massa tempor convallis"}

Response

[
    {
        "id": "20bf9ab5-ae07-4728-837b-effa98e46f17",
        "created": "2014-02-17T17:52:01.000+0000",
        "updated": "2014-05-27T17:53:26.000+0000",
        "name": "integer",
        "action": "morbi porttitor"
    }
]

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/roles' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request PUT --data '{"id":"137e85b5-65da-46a5-96b5-9223f1e4acb1","updated":"2014-06-29T15:34:14.000+0000","created":"2014-07-09T05:06:13.000+0000","name":"ridiculus mus etiam","action":"integer"}

Response

[
    {
        "id": "c426638d-ba7d-4e64-b0e0-f7bc3a1a20c4",
        "created": "2014-04-06T20:48:58.000+0000",
        "updated": "2013-09-02T07:08:24.000+0000",
        "name": "odio",
        "action": "orci eget orci vehicula"
    }
]

delete [DELETE]

Deletes the Roles assigned to the identified Service Definition.

Parameters

Parameter Required Type Description
serviceId true string Service identifier.

Returns

Success

Empty response

Failure

Array of validation responses

Examples

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/roles' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request DELETE

Response

[
    ""
]

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/roles' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request DELETE

Response

[
    ""
]

Docs Navigation