Packages

Resource URI

/packages/{packageId}

Items in curly braces represent variables.

Description

A package object stores data for limit-based notifications, e.g. sending an email to a developer when they near their quota usage, as well as an array of plans. Packages are a collection of plans which in turn are a collection of services, endpoints and methods that ultimately can be used by a developer.

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 Package name.
description Type string
Sub-type
Create Rule Optional
Update Rule Optional
Fetch Rule Implicit
Description Package description.
notifyDeveloperPeriod Type string
Sub-type enum
Create Rule Optional
Update Rule Optional
Fetch Rule Implicit
Description enum literals: minute, hour, day, week, month
notifyDeveloperNearQuota Type boolean
Sub-type
Create Rule Optional
Update Rule Optional
Fetch Rule Explicit
Description Notify developer when approaching quota.
notifyDeveloperOverQuota Type boolean
Sub-type
Create Rule Optional
Update Rule Optional
Fetch Rule Explicit
Description Notify developer when quota exceeded.
notifyDeveloperOverThrottle Type boolean
Sub-type
Create Rule Optional
Update Rule Optional
Fetch Rule Explicit
Description Notify developer when throttle exceeded.
notifyAdminPeriod Type string
Sub-type enum
Create Rule Optional
Update Rule Optional
Fetch Rule Implicit
Description enum literals: minute, hour, day, week, month
notifyAdminNearQuota Type boolean
Sub-type
Create Rule Optional
Update Rule Optional
Fetch Rule Explicit
Description Notify admin when approaching quota.
notifyAdminOverQuota Type boolean
Sub-type
Create Rule Optional
Update Rule Optional
Fetch Rule Explicit
Description Notify admin when quota exceeded.
notifyAdminOverThrottle Type boolean
Sub-type
Create Rule Optional
Update Rule Optional
Fetch Rule Explicit
Description Notify admin when throttle exceeded.
notifyAdminEmails Type string
Sub-type
Create Rule Optional
Update Rule Optional
Fetch Rule Implicit
Description Email address to send admin notifications.
nearQuotaThreshold Type integer
Sub-type
Create Rule Optional
Update Rule Optional
Fetch Rule Implicit
Description Percentage of quota when approaching limit notifications will be sent.
eav Type object
Sub-type
Create Rule Optional
Update Rule Optional
Fetch Rule Explicit
Description Extended attribute values
keyAdapter Type string
Sub-type
Create Rule Optional
Update Rule Optional
Fetch Rule Implicit
Description Custom adapter for key generation.
keyLength Type integer
Sub-type
Create Rule Optional
Update Rule Optional
Fetch Rule Implicit
Description Length of keys for this package.
sharedSecretLength Type integer
Sub-type
Create Rule Optional
Update Rule Optional
Fetch Rule Implicit
Description Length of shared secret for this package.
plans Type array
Sub-type Plan
Create Rule Optional
Update Rule Optional
Fetch Rule Explicit
Description Plans that belong to this package.

fetch all [GET]

Retrieves collection of Packages with their respective Plans belonging to the given Area.

Parameters

Parameter Required Type Description
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 Packages for the Area 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/packages' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" 

Response

[
    {
        "notifyAdminOverQuota": true,
        "notifyDeveloperPeriod": "day",
        "notifyAdminPeriod": "month",
        "notifyDeveloperNearQuota": true,
        "id": "360dbb51-ad7c-4b93-8dd9-736760be2f1b",
        "sharedSecretLength": 92,
        "created": "2014-06-30T04:57:49.000+0000",
        "updated": "2014-03-03T08:10:34.000+0000",
        "description": "sapien ut nunc vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae mauris",
        "name": "nam tristique tortor",
        "notifyAdminOverThrottle": false,
        "keyAdapter": "volutpat eleifend donec ut",
        "notifyDeveloperOverQuota": false,
        "notifyAdminEmails": "facilisi cras",
        "notifyAdminNearQuota": true,
        "notifyDeveloperOverThrottle": false,
        "nearQuotaThreshold": 67,
        "keyLength": 76
    }
]

Request

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

Response

[
    {
        "id": "9b8f5b63-2dd8-4cbc-ac22-86e5dc61d251",
        "sharedSecretLength": 30,
        "notifyDeveloperPeriod": "minute",
        "created": "2014-03-27T03:02:42.000+0000",
        "updated": "2014-01-19T12:16:42.000+0000",
        "description": "pulvinar sed nisl nunc rhoncus dui vel sem sed sagittis nam",
        "name": "a ipsum integer a",
        "notifyAdminPeriod": "month",
        "keyAdapter": "felis sed",
        "notifyAdminEmails": "aliquet pulvinar sed nisl",
        "nearQuotaThreshold": 86,
        "keyLength": 72
    }
]

fetch [GET]

Retrieves the Package, returning a Package

Parameters

Parameter Required Type Description
packageId true string Package 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

Package as identified 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/packages/83cca97c-986b-468c-b277-525b633909a9' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" 

Response

[
    {
        "notifyAdminOverQuota": true,
        "notifyDeveloperPeriod": "hour",
        "notifyAdminPeriod": "minute",
        "notifyDeveloperNearQuota": true,
        "id": "1bf2ea76-9e3a-4673-83e7-900de3dedef5",
        "sharedSecretLength": 31,
        "created": "2014-03-26T11:34:49.000+0000",
        "updated": "2013-12-23T17:25:19.000+0000",
        "description": "eu tincidunt in leo maecenas pulvinar lobortis est phasellus sit amet erat nulla tempus vivamus",
        "name": "praesent id massa id",
        "notifyAdminOverThrottle": false,
        "keyAdapter": "etiam faucibus cursus",
        "notifyDeveloperOverQuota": false,
        "notifyAdminEmails": "fermentum",
        "notifyAdminNearQuota": false,
        "notifyDeveloperOverThrottle": false,
        "nearQuotaThreshold": 6,
        "keyLength": 65
    }
]

Request

curl -k 'https://api.mashery.com/v3/rest/packages/83cca97c-986b-468c-b277-525b633909a9' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" 

Response

[
    {
        "id": "57a60859-3725-442c-8418-98d8a6f4f266",
        "sharedSecretLength": 81,
        "notifyDeveloperPeriod": "week",
        "created": "2013-08-17T21:35:21.000+0000",
        "updated": "2014-06-13T22:59:04.000+0000",
        "description": "ut volutpat sapien arcu sed augue aliquam erat volutpat in congue etiam justo etiam pretium iaculis",
        "name": "habitasse platea dictumst morbi",
        "notifyAdminPeriod": "month",
        "keyAdapter": "ipsum primis",
        "notifyAdminEmails": "vestibulum sit",
        "nearQuotaThreshold": 17,
        "keyLength": 57
    }
]

create [POST]

Creates a new Package in the given area.

Parameters

Parameter Required Type Description
package true object Package object

Returns

Success

Package 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/packages' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request POST --data '{"notifyAdminOverQuota":true,"notifyDeveloperPeriod":"hour","notifyAdminPeriod":"day","notifyDeveloperNearQuota":true,"id":"49f30479-3130-4959-977f-6f28a39e3622","sharedSecretLength":76,"created":"2013-12-01T22:02:36.000+0000","updated":"2014-03-05T19:38:24.000+0000","description":"nunc purus phasellus in felis donec semper sapien a libero nam dui proin leo odio porttitor id consequat","name":"bibendum morbi non quam","notifyAdminOverThrottle":true,"keyAdapter":"semper rutrum nulla","notifyAdminEmails":"fusce consequat nulla nisl","notifyDeveloperOverQuota":true,"keyLength":11,"nearQuotaThreshold":50,"notifyDeveloperOverThrottle":true,"notifyAdminNearQuota":false}

Response

[
    {
        "notifyAdminOverQuota": true,
        "notifyDeveloperPeriod": "hour",
        "notifyAdminPeriod": "day",
        "notifyDeveloperNearQuota": true,
        "id": "8f07b7b2-fff0-4f2b-b7b9-445bf0d422fd",
        "sharedSecretLength": 25,
        "created": "2013-12-25T14:01:52.000+0000",
        "updated": "2013-10-27T06:00:28.000+0000",
        "description": "nulla nisl nunc nisl duis bibendum felis sed interdum venenatis turpis enim blandit mi in porttitor pede justo eu",
        "name": "lectus",
        "notifyAdminOverThrottle": true,
        "keyAdapter": "non velit nec",
        "notifyDeveloperOverQuota": true,
        "notifyAdminEmails": "ipsum dolor sit amet",
        "notifyAdminNearQuota": false,
        "notifyDeveloperOverThrottle": true,
        "nearQuotaThreshold": 79,
        "keyLength": 75
    }
]

Request

curl -k 'https://api.mashery.com/v3/rest/packages' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request POST --data '{"id":"bb9060f6-c8a0-46bf-b0cd-e4674418f0be","sharedSecretLength":90,"notifyDeveloperPeriod":"week","updated":"2013-08-27T06:26:03.000+0000","created":"2013-07-28T06:16:22.000+0000","description":"gravida nisi at nibh in hac habitasse platea dictumst aliquam augue quam sollicitudin vitae consectetuer eget rutrum at lorem integer","notifyAdminPeriod":"week","name":"consequat metus sapien ut","keyAdapter":"orci luctus","notifyAdminEmails":"donec posuere metus vitae","keyLength":32,"nearQuotaThreshold":85}

Response

[
    {
        "id": "6cabbc77-dd41-4bc7-9389-5e266bdf6038",
        "sharedSecretLength": 70,
        "notifyDeveloperPeriod": "day",
        "created": "2013-10-09T02:43:51.000+0000",
        "updated": "2014-02-19T23:18:35.000+0000",
        "description": "id ornare imperdiet sapien urna pretium nisl ut volutpat sapien arcu sed augue aliquam erat volutpat in",
        "name": "felis fusce posuere",
        "notifyAdminPeriod": "hour",
        "keyAdapter": "tristique tortor eu pede",
        "notifyAdminEmails": "orci eget orci vehicula",
        "nearQuotaThreshold": 31,
        "keyLength": 32
    }
]

update [PUT]

Updates the identified Package.

Parameters

Parameter Required Type Description
packageId true string Package identifier.
package true object Package object

Returns

Success

Package 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/packages/83cca97c-986b-468c-b277-525b633909a9' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request PUT --data '{"notifyAdminOverQuota":false,"notifyDeveloperPeriod":"week","notifyAdminPeriod":"day","notifyDeveloperNearQuota":false,"id":"9ec344b9-e5aa-4498-9477-04e8c234e08d","sharedSecretLength":10,"created":"2014-05-04T01:18:05.000+0000","updated":"2013-09-12T18:39:31.000+0000","description":"nisi vulputate nonummy maecenas tincidunt lacus at velit vivamus vel nulla eget","name":"elementum in hac habitasse","notifyAdminOverThrottle":false,"keyAdapter":"vitae","notifyAdminEmails":"nisl duis bibendum","notifyDeveloperOverQuota":true,"keyLength":80,"nearQuotaThreshold":4,"notifyDeveloperOverThrottle":true,"notifyAdminNearQuota":true}

Response

[
    {
        "notifyAdminOverQuota": false,
        "notifyDeveloperPeriod": "week",
        "notifyAdminPeriod": "day",
        "notifyDeveloperNearQuota": false,
        "id": "53757937-929a-462e-953c-98cca9959695",
        "sharedSecretLength": 68,
        "created": "2014-04-24T15:51:58.000+0000",
        "updated": "2014-04-28T13:11:08.000+0000",
        "description": "rhoncus sed vestibulum sit amet cursus id turpis integer aliquet massa",
        "name": "curabitur at",
        "notifyAdminOverThrottle": true,
        "keyAdapter": "at turpis",
        "notifyDeveloperOverQuota": true,
        "notifyAdminEmails": "eu nibh",
        "notifyAdminNearQuota": true,
        "notifyDeveloperOverThrottle": false,
        "nearQuotaThreshold": 95,
        "keyLength": 72
    }
]

Request

curl -k 'https://api.mashery.com/v3/rest/packages/83cca97c-986b-468c-b277-525b633909a9' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request PUT --data '{"id":"309868d3-a6d7-45c4-9cf3-686853d6f592","sharedSecretLength":5,"notifyDeveloperPeriod":"day","updated":"2014-05-16T13:13:05.000+0000","created":"2013-11-27T11:18:19.000+0000","description":"augue vestibulum rutrum rutrum neque aenean auctor gravida sem praesent id","notifyAdminPeriod":"week","name":"curabitur at ipsum","keyAdapter":"libero ut massa","notifyAdminEmails":"et eros","keyLength":54,"nearQuotaThreshold":61}

Response

[
    {
        "id": "3f33b64f-7bda-44ac-b1a2-be11f3bea320",
        "sharedSecretLength": 74,
        "notifyDeveloperPeriod": "minute",
        "created": "2014-04-20T09:36:05.000+0000",
        "updated": "2013-08-31T14:37:45.000+0000",
        "description": "quis augue luctus tincidunt nulla mollis molestie lorem quisque ut erat curabitur gravida nisi",
        "name": "ipsum ac tellus",
        "notifyAdminPeriod": "hour",
        "keyAdapter": "convallis",
        "notifyAdminEmails": "volutpat quam pede",
        "nearQuotaThreshold": 67,
        "keyLength": 14
    }
]

delete [DELETE]

Deletes the identified Package.

Parameters

Parameter Required Type Description
packageId true string Package identifier.

Returns

Success

Empty response

Failure

Array of validation responses

Examples

Request

curl -k 'https://api.mashery.com/v3/rest/packages/83cca97c-986b-468c-b277-525b633909a9' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request DELETE

Response

[
    ""
]

Request

curl -k 'https://api.mashery.com/v3/rest/packages/83cca97c-986b-468c-b277-525b633909a9' -H "Authorization: Bearer <insert your token here>" -H "Content-Type:application/json" --request DELETE

Response

[
    ""
]

Docs Navigation