Methods

Resource URI

/services/{serviceId}/endpoints/{endpointId}/methods/{methodId}

Items in curly braces represent variables.

Description

Methods are units of reporting, representing the individual callable resources within an endpoint.

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.
name Type string
Sub-type
Create Rule Required
Update Rule Optional
Fetch Rule Implicit
Description Method name.
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.
sampleJsonResponse Type string
Sub-type
Create Rule Optional
Update Rule Optional
Fetch Rule Explicit
Description A valid XML schema can be entered in this field. This definition can help you set response filters.
sampleXmlResponse Type string
Sub-type
Create Rule Optional
Update Rule Optional
Fetch Rule Explicit
Description A valid JSON schema can be entered in this field. This definition can help you set response filters.

fetch all [GET]

Retrieves collection of Methods for the Endpoint in the identified Service Definition, returning an Array of Service Definition Methods

Parameters

Parameter Required Type Description
serviceId true string Service identifier.
endpointId true string Endpoint 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.
indent false boolean When set to true, responses are indented for better readability.

Returns

Success

Array of ServiceDefinitionEndpointMethods for the Service 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/endpoints/0dd96770b82f4f248c4711d9/methods' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" 

Response

[
    {
        "id": "3b7c71fd-39fb-4f93-96bf-1f88ae2e1399",
        "created": "2013-12-06T01:30:41.000+0000",
        "updated": "2014-03-21T09:28:06.000+0000",
        "sampleJsonResponse": "sed augue aliquam",
        "name": "posuere cubilia",
        "sampleXmlResponse": "consequat morbi"
    }
]

Request

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

Response

[
    {
        "id": "7afcf8fc-778c-4b92-b3b5-e39828ccfdba",
        "created": "2014-04-07T03:07:00.000+0000",
        "updated": "2014-01-17T21:59:50.000+0000",
        "name": "curae"
    }
]

fetch [GET]

Retrieves the identified Method for the Endpoint, returning a Service Definition Method

Parameters

Parameter Required Type Description
serviceId true string Service identifier.
endpointId true string Endpoint identifier.
methodId true string Method 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.
indent false boolean When set to true, responses are indented for better readability.

Returns

Success

ServiceDefinitionEndpointMethod for the Service 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/endpoints/0dd96770b82f4f248c4711d9/methods/9f42d173-42f8-4862-b3e8-826e9de55ecd' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" 

Response

[
    {
        "id": "6c95c139-746f-4e79-9327-fa87736b080e",
        "created": "2014-07-05T01:47:33.000+0000",
        "updated": "2014-02-05T02:21:46.000+0000",
        "sampleJsonResponse": "et",
        "name": "morbi non",
        "sampleXmlResponse": "vitae mattis nibh"
    }
]

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/endpoints/0dd96770b82f4f248c4711d9/methods/9f42d173-42f8-4862-b3e8-826e9de55ecd' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" 

Response

[
    {
        "id": "e660718b-cec3-4f8e-bcc7-b7b1e44d07c6",
        "created": "2014-03-31T05:35:22.000+0000",
        "updated": "2014-03-30T03:34:55.000+0000",
        "name": "nascetur ridiculus"
    }
]

create [POST]

Creates a new Service Definition Method in the given Endpoint in the given Service Definition.

Parameters

Parameter Required Type Description
serviceId true string Service identifier.
endpointId true string Endpoint identifier.
method true object ServiceDefinitionEndpointMethod object

Returns

Success

ServiceDefinitionEndpointMethod as created 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/endpoints/0dd96770b82f4f248c4711d9/methods' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request POST --data '{"id":"64c80442-bf3f-4a9e-9c67-826bb1841331","sampleJsonResponse":"consectetuer adipiscing elit proin","updated":"2013-10-07T11:36:44.000+0000","created":"2014-05-25T00:17:14.000+0000","name":"magna vulputate luctus cum","sampleXmlResponse":"nunc donec quis orci"}

Response

[
    {
        "id": "4586d9f6-0a99-4493-9061-d551900ef400",
        "created": "2013-12-09T06:19:01.000+0000",
        "updated": "2013-10-30T10:59:54.000+0000",
        "sampleJsonResponse": "blandit",
        "name": "congue vivamus",
        "sampleXmlResponse": "eget vulputate"
    }
]

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/endpoints/0dd96770b82f4f248c4711d9/methods' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request POST --data '{"id":"a2e897ca-fd4e-4a1f-a831-633758c7b56b","updated":"2013-08-05T11:18:26.000+0000","created":"2013-12-13T00:23:54.000+0000","name":"vel"}

Response

[
    {
        "id": "d84cabec-34c9-4995-a631-0c3ab06067b6",
        "created": "2013-10-24T02:24:30.000+0000",
        "updated": "2014-03-22T11:53:30.000+0000",
        "name": "rhoncus mauris enim"
    }
]

update [PUT]

Updates the identified Service Definition Method.

Parameters

Parameter Required Type Description
serviceId true string Service identifier.
endpointId true string Endpoint identifier.
methodId true string Method identifier.
method true object ServiceDefinitionEndpointMethod object

Returns

Success

ServiceDefinitionEndpointMethod as persisted 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/endpoints/0dd96770b82f4f248c4711d9/methods/9f42d173-42f8-4862-b3e8-826e9de55ecd' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request PUT --data '{"id":"87187e7c-ccd2-405b-bc63-c9e2ea1d7549","sampleJsonResponse":"at nunc commodo placerat","updated":"2014-07-15T01:22:36.000+0000","created":"2013-07-23T18:32:10.000+0000","name":"amet consectetuer","sampleXmlResponse":"et ultrices posuere"}

Response

[
    {
        "id": "706de814-b58d-4125-b9da-842179d9691f",
        "created": "2013-09-25T10:00:18.000+0000",
        "updated": "2014-01-19T05:07:07.000+0000",
        "sampleJsonResponse": "lorem",
        "name": "pede",
        "sampleXmlResponse": "morbi vestibulum velit id"
    }
]

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/endpoints/0dd96770b82f4f248c4711d9/methods/9f42d173-42f8-4862-b3e8-826e9de55ecd' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request PUT --data '{"id":"a3a83fa8-49d5-441b-8bae-2759ab4b20ee","updated":"2014-07-06T07:27:54.000+0000","created":"2013-09-28T18:09:12.000+0000","name":"duis consequat dui"}

Response

[
    {
        "id": "41cfe5f1-ddcb-482c-bfd2-8d71f2e3b6c2",
        "created": "2013-10-03T06:30:17.000+0000",
        "updated": "2014-01-27T21:27:59.000+0000",
        "name": "quis"
    }
]

delete [DELETE]

Deletes the identified Service Definition Method.

Parameters

Parameter Required Type Description
serviceId true string Service identifier.
endpointId true string Endpoint identifier.
methodId true string Method identifier.

Returns

Success

Empty response

Failure

Array of validation responses

Examples

Request

curl -k 'https://api.mashery.com/v3/rest/services/0fcc39d1c7ee470780e6cbe6/endpoints/0dd96770b82f4f248c4711d9/methods/9f42d173-42f8-4862-b3e8-826e9de55ecd' -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/endpoints/0dd96770b82f4f248c4711d9/methods/9f42d173-42f8-4862-b3e8-826e9de55ecd' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request DELETE

Response

[
    ""
]

Docs Navigation