Before Creating a Package Key
This event trigger is fired when an package key object is created in the Mashery platform. Package Keys are created:
During the registration process (via the portal)
Via the Administrative Dashboard (Package Keys tab)
Via the Mashery API.
This event trigger event is executed before the actual package key object is saved in the Mashery database. As such, data can be enriched, e.g. adding data from your own systems into the Mashery package key object, or a decision could be returned to not permit the save operation.
Event Trigger Call Structure (Mashery to Customer-hosted Endpoint)
HTTP Method |
POST |
Path |
/v1/package_key |
Parameters |
event=pre-create&txn=<transaction id will be provided at event trigger execution time> |
Body |
JSON, or application/x-www-form-urlencoded, representation of package key object. This is determined by the setting found in the Integration tab of Portal Settings in the Mashery Console. |
Example Call:
POST /v1/package_key?event=pre-create&txn=46f6497a6b284411aa715427608e6df2 HTTP/1.1
Host: api.customer.com
Accept: application/json
Package Key-Agent: Mashery Event Trigger 1.0
Content-Type: application/json
{
"apikey": "bs8ssd5wjeekc797t6ar47v2",
"secret": "",
"rate_limit_ceiling": 0,
"rate_limit_exempt": false,
"qps_limit_ceiling": 0,
"qps_limit_exempt": false,
"status": "active",
"created": "1970-01-01T00:00:00Z",
"updated": "1970-01-01T00:00:00Z",
"limits": [
{
"period": "second",
"source": "plan",
"ceiling": 2
},
{
"period": "day",
"source": "plan",
"ceiling": 5000
}
],
"object_type": "package_key",
"member": {
"created": "2012-03-07T05:00:09Z",
"updated": "2012-03-08T20:32:18Z",
"username": "partner1_dev1",
"email": "jpollock@mashery.com",
"display_name": "partner1_dev1",
"uri": "",
"blog": "",
"im": "",
"imsvc": "",
"phone": "",
"company": "",
"address1": "",
"address2": "",
"locality": "",
"region": "",
"postal_code": "",
"country_code": "",
"first_name": "",
"last_name": "",
"registration_ipaddr": "",
"area_status": "active",
"external_id": "",
"object_type": "member"
},
"application": {
"id": 80,
"created": "2013-02-19T20:55:20Z",
"updated": "2013-02-19T20:55:20Z",
"username": "partner1_dev1",
"name": "Package-based App",
"description": "",
"type": "",
"commercial": false,
"ads": false,
"ads_system": "",
"usage_model": "",
"tags": "",
"notes": "",
"how_did_you_hear": "",
"preferred_protocol": "",
"preferred_output": "",
"external_id": "",
"uri": "",
"status": "draft",
"group_id": 0,
"developer_group_handle": "",
"is_packaged": true,
"oauth_redirect_uri": "",
"object_type": "application"
},
"package": {
"id": 9,
"name": "Music API",
"description": "",
"notify_developer_period": "day",
"notify_developer_near_quota": false,
"notify_developer_over_quota": false,
"notify_developer_over_throttle": false,
"notify_admin_period": "day",
"notify_admin_near_quota": false,
"notify_admin_over_quota": false,
"notify_admin_over_throttle": false,
"notify_admin_emails": "",
"near_quota_threshold": 50,
"created": "2013-01-31T22:31:25Z",
"updated": "2013-02-12T16:49:19Z",
"key_adapter": "",
"key_length": 10,
"shared_secret_length": 0,
"status": "public",
"is_using_shared_secret": false,
"object_type": "package",
},
"plan": {
"id": 16,
"name": "Basic",
"description": "",
"notes": "",
"rate_limit_ceiling": 5000,
"rate_limit_exempt": false,
"rate_limit_order_override_allowed": true,
"rate_limit_key_override_allowed": true,
"rate_limit_period": "day",
"qps_limit_ceiling": 2,
"qps_limit_exempt": false,
"qps_limit_order_override_allowed": true,
"qps_limit_key_override_allowed": false,
"order_max": 4,
"order_moderation_threshold": 0,
"response_filter_override_allowed": true,
"created": "2013-01-31T22:31:26Z",
"updated": "2013-01-31T22:31:26Z",
"is_public": true,
"is_moderated": true,
"status": "active",
"limits": [
{
"period": "second",
"source": "plan",
"ceiling": 2
},
{
"period": "day",
"source": "plan",
"ceiling": 5000
}
],
"object_type": "plan"
}
}
Expected Response Sent from Customer-hosted Endpoint
HTTP Response Code |
Content Type |
Content |
200 |
application/json |
{"type":"proceed"}
Example Response:
HTTP/1.1 200 OK
Server: nginx/1.3.13
Date: Fri, 05 Apr 2013 18:41:41 GMT
Content-Type: application/json
Connection: keep-alive
Vary: Accept-Encoding
X-Original-Transfer-Encoding: chunked
Content-Length: 18
{"type":"proceed"}
|
200 |
application/json |
{"type":"proceed_with_changes","params": [array of object fields and values]}
Example Response:
HTTP/1.1 200 OK
Server: nginx/1.3.13
Date: Fri, 05 Apr 2013 18:43:13 GMT
Content-Type: application/json
Connection: keep-alive
Vary: Accept-Encoding
X-Original-Transfer-Encoding: chunked
Content-Length: 77
{"type":"proceed_with_changes","params": [{"apikey": "12124mycustomkey"}]}
|
400 |
application/json |
{"type":"stop","error": {"code":-32600, "message":"<Insert error message>","data":[array of object fields and error messages]}}
Example Response:
HTTP/1.1 400 Bad Request
Server: nginx/1.3.13
Date: Fri, 05 Apr 2013 18:43:57 GMT
Content-Type: application/json
Connection: keep-alive
Vary: Accept-Encoding
X-Original-Transfer-Encoding: chunked
Content-Length: 136
{"type":"stop","error": {"code":-32600, "message":"That will never work","data":[{"field":"apikey","message":"Key is not unique in our system"}]}}
|
After Creating a Package Key
This event trigger is fired when a applicationobject is created in the Mashery platform. Package Keys are created:
During the registration process (via the portal)
Via the Administrative Dashboard (Package Keys tab)
Via the Mashery API.
This event trigger event is executed after the actual package key object is saved in the Mashery database.
Event Trigger Call Structure (Mashery to Customer-hosted Endpoint)
HTTP Method |
PUT |
Path |
/v1/package_key/<package key id> |
Parameters |
event=post-create&txn=<transaction id will be provided at event trigger execution time> |
Body |
JSON, or application/x-www-form-urlencoded, representation of package key object. This is determined by the setting found in the Integration tab of Portal Settings in the Mashery Console. |
Example Call:
PUT /v1/package_key/14398445?event=post-create&txn=46f6497a6b284411aa715427608e6df2 HTTP/1.1
Host: api.customer.com
Accept: application/json
Package Key-Agent: Mashery Event Trigger 1.0
Content-Type: application/json
{
"id": 1000,
"apikey": "bs8ssd5wjeekc797t6ar47v2",
"secret": "",
"rate_limit_ceiling": 0,
"rate_limit_exempt": false,
"qps_limit_ceiling": 0,
"qps_limit_exempt": false,
"status": "active",
"created": "1970-01-01T00:00:00Z",
"updated": "1970-01-01T00:00:00Z",
"limits": [
{
"period": "second",
"source": "plan",
"ceiling": 2
},
{
"period": "day",
"source": "plan",
"ceiling": 5000
}
],
"object_type": "package_key",
"member": {
"created": "2012-03-07T05:00:09Z",
"updated": "2012-03-08T20:32:18Z",
"username": "partner1_dev1",
"email": "jpollock@mashery.com",
"display_name": "partner1_dev1",
"uri": "",
"blog": "",
"im": "",
"imsvc": "",
"phone": "",
"company": "",
"address1": "",
"address2": "",
"locality": "",
"region": "",
"postal_code": "",
"country_code": "",
"first_name": "",
"last_name": "",
"registration_ipaddr": "",
"area_status": "active",
"external_id": "",
"object_type": "member"
},
"application": {
"id": 80,
"created": "2013-02-19T20:55:20Z",
"updated": "2013-02-19T20:55:20Z",
"username": "partner1_dev1",
"name": "Package-based App",
"description": "",
"type": "",
"commercial": false,
"ads": false,
"ads_system": "",
"usage_model": "",
"tags": "",
"notes": "",
"how_did_you_hear": "",
"preferred_protocol": "",
"preferred_output": "",
"external_id": "",
"uri": "",
"status": "draft",
"group_id": 0,
"developer_group_handle": "",
"is_packaged": true,
"oauth_redirect_uri": "",
"object_type": "application"
},
"package": {
"id": 9,
"name": "Music API",
"description": "",
"notify_developer_period": "day",
"notify_developer_near_quota": false,
"notify_developer_over_quota": false,
"notify_developer_over_throttle": false,
"notify_admin_period": "day",
"notify_admin_near_quota": false,
"notify_admin_over_quota": false,
"notify_admin_over_throttle": false,
"notify_admin_emails": "",
"near_quota_threshold": 50,
"created": "2013-01-31T22:31:25Z",
"updated": "2013-02-12T16:49:19Z",
"key_adapter": "",
"key_length": 10,
"shared_secret_length": 0,
"status": "public",
"is_using_shared_secret": false,
"object_type": "package",
},
"plan": {
"id": 16,
"name": "Basic",
"description": "",
"notes": "",
"rate_limit_ceiling": 5000,
"rate_limit_exempt": false,
"rate_limit_order_override_allowed": true,
"rate_limit_key_override_allowed": true,
"rate_limit_period": "day",
"qps_limit_ceiling": 2,
"qps_limit_exempt": false,
"qps_limit_order_override_allowed": true,
"qps_limit_key_override_allowed": false,
"order_max": 4,
"order_moderation_threshold": 0,
"response_filter_override_allowed": true,
"created": "2013-01-31T22:31:26Z",
"updated": "2013-01-31T22:31:26Z",
"is_public": true,
"is_moderated": true,
"status": "active",
"limits": [
{
"period": "second",
"source": "plan",
"ceiling": 2
},
{
"period": "day",
"source": "plan",
"ceiling": 5000
}
],
"object_type": "plan"
}
}
Expected Response Sent from Customer-hosted Endpoint
Response Code |
HTTP status code - any non-200 response will be considered failure; future capabilities will allow for re-try of this operation if error received. Response does not impact any database operations - the data is already saved in the database and that operation cannot be rolled back due to a non-200 response - nor does it result in end-user errors. |
Content Type |
application/json |
Content |
Member JSON string (valid JSON) |
Before Updating a Package Key
This event trigger is fired when an package key object is updated, or modified, in the Mashery platform. Package Keys are updated:
By the user in the Portal My Account area
Via the Administrative Dashboard (Package Keys tab)
Via the Mashery API.
This event trigger event is executed before the actual package key object is saved in the Mashery database. As such, data can be enriched, e.g. adding data from your own systems into the Mashery package key object, or a decision could be returned to not permit the save operation.
Event Trigger Call Structure (Mashery to Customer-hosted Endpoint)
HTTP Method |
PUT |
Path |
/v1/package_key/<package key id> |
Parameters |
event=pre-update&txn=<transaction id will be provided at event trigger execution time> |
Body |
JSON, or application/x-www-form-urlencoded, representation of package key object. This is determined by the setting found in the Integration tab of Portal Settings in the Mashery Console. |
Example Call:
PUT /v1/package_key/14398445?event=pre-update&txn=8807190f73701b1bdf5a2272f445366f HTTP/1.1
Host: api.customer.com
Accept: application/json
Package Key-Agent: Mashery Event Trigger 1.0
Content-Type: application/json
{
"id": 1000,
"apikey": "bs8ssd5wjeekc797t6ar47v2",
"secret": "",
"rate_limit_ceiling": 0,
"rate_limit_exempt": false,
"qps_limit_ceiling": 0,
"qps_limit_exempt": false,
"status": "active",
"created": "1970-01-01T00:00:00Z",
"updated": "1970-01-01T00:00:00Z",
"limits": [
{
"period": "second",
"source": "plan",
"ceiling": 2
},
{
"period": "day",
"source": "plan",
"ceiling": 5000
}
],
"object_type": "package_key",
"member": {
"created": "2012-03-07T05:00:09Z",
"updated": "2012-03-08T20:32:18Z",
"username": "partner1_dev1",
"email": "jpollock@mashery.com",
"display_name": "partner1_dev1",
"uri": "",
"blog": "",
"im": "",
"imsvc": "",
"phone": "",
"company": "",
"address1": "",
"address2": "",
"locality": "",
"region": "",
"postal_code": "",
"country_code": "",
"first_name": "",
"last_name": "",
"registration_ipaddr": "",
"area_status": "active",
"external_id": "",
"object_type": "member"
},
"application": {
"id": 80,
"created": "2013-02-19T20:55:20Z",
"updated": "2013-02-19T20:55:20Z",
"username": "partner1_dev1",
"name": "Package-based App",
"description": "",
"type": "",
"commercial": false,
"ads": false,
"ads_system": "",
"usage_model": "",
"tags": "",
"notes": "",
"how_did_you_hear": "",
"preferred_protocol": "",
"preferred_output": "",
"external_id": "",
"uri": "",
"status": "draft",
"group_id": 0,
"developer_group_handle": "",
"is_packaged": true,
"oauth_redirect_uri": "",
"object_type": "application"
},
"package": {
"id": 9,
"name": "Music API",
"description": "",
"notify_developer_period": "day",
"notify_developer_near_quota": false,
"notify_developer_over_quota": false,
"notify_developer_over_throttle": false,
"notify_admin_period": "day",
"notify_admin_near_quota": false,
"notify_admin_over_quota": false,
"notify_admin_over_throttle": false,
"notify_admin_emails": "",
"near_quota_threshold": 50,
"created": "2013-01-31T22:31:25Z",
"updated": "2013-02-12T16:49:19Z",
"key_adapter": "",
"key_length": 10,
"shared_secret_length": 0,
"status": "public",
"is_using_shared_secret": false,
"object_type": "package",
},
"plan": {
"id": 16,
"name": "Basic",
"description": "",
"notes": "",
"rate_limit_ceiling": 5000,
"rate_limit_exempt": false,
"rate_limit_order_override_allowed": true,
"rate_limit_key_override_allowed": true,
"rate_limit_period": "day",
"qps_limit_ceiling": 2,
"qps_limit_exempt": false,
"qps_limit_order_override_allowed": true,
"qps_limit_key_override_allowed": false,
"order_max": 4,
"order_moderation_threshold": 0,
"response_filter_override_allowed": true,
"created": "2013-01-31T22:31:26Z",
"updated": "2013-01-31T22:31:26Z",
"is_public": true,
"is_moderated": true,
"status": "active",
"limits": [
{
"period": "second",
"source": "plan",
"ceiling": 2
},
{
"period": "day",
"source": "plan",
"ceiling": 5000
}
],
"object_type": "plan"
}
}
Expected Response Sent from Customer-hosted Endpoint
HTTP Response Code |
Content Type |
Content |
200 |
application/json |
{"type":"proceed"}
Example Response:
HTTP/1.1 200 OK
Server: nginx/1.3.13
Date: Fri, 05 Apr 2013 18:41:41 GMT
Content-Type: application/json
Connection: keep-alive
Vary: Accept-Encoding
X-Original-Transfer-Encoding: chunked
Content-Length: 18
{"type":"proceed"}
|
200 |
application/json |
{"type":"proceed_with_changes","params": [array of object fields and values]}
Example Response:
HTTP/1.1 200 OK
Server: nginx/1.3.13
Date: Fri, 05 Apr 2013 18:43:13 GMT
Content-Type: application/json
Connection: keep-alive
Vary: Accept-Encoding
X-Original-Transfer-Encoding: chunked
Content-Length: 77
{"type":"proceed_with_changes","params": [{"apikey": "12124mycustomkey"}]}
|
400 |
application/json |
{"type":"stop","error": {"code":-32600, "message":"<Insert error message>","data":[array of object fields and error messages]}}
Example Response:
HTTP/1.1 400 Bad Request
Server: nginx/1.3.13
Date: Fri, 05 Apr 2013 18:43:57 GMT
Content-Type: application/json
Connection: keep-alive
Vary: Accept-Encoding
X-Original-Transfer-Encoding: chunked
Content-Length: 136
{"type":"stop","error": {"code":-32600, "message":"That will never work","data":[{"field":"apikey","message":"Key is not unique in our system"}]}}
|
After Updating a Package Key
This event trigger is fired when an updated, or modified, package key object is saved in the Mashery platform. This event trigger event is executed after the actual package key object is saved in the Mashery database.
Event Trigger Call Structure (Mashery to Customer-hosted Endpoint)
HTTP Method |
PUT |
Path |
/v1/package_key/<package key id> |
Parameters |
event=post-update&txn=<transaction id will be provided at event trigger execution time> |
Body |
JSON, or application/x-www-form-urlencoded, representation of package key object. This is determined by the setting found in the Integration tab of Portal Settings in the Mashery Console. |
Example Call:
PUT /v1/package_key/14398445?event=post-update&txn=8807190f73701b1bdf5a2272f445366f HTTP/1.1
Host: api.customer.com
Accept: application/json
Package Key-Agent: Mashery Event Trigger 1.0
Content-Type: application/json
{
"id": 1000,
"apikey": "bs8ssd5wjeekc797t6ar47v2",
"secret": "",
"rate_limit_ceiling": 0,
"rate_limit_exempt": false,
"qps_limit_ceiling": 0,
"qps_limit_exempt": false,
"status": "active",
"created": "1970-01-01T00:00:00Z",
"updated": "1970-01-01T00:00:00Z",
"limits": [
{
"period": "second",
"source": "plan",
"ceiling": 2
},
{
"period": "day",
"source": "plan",
"ceiling": 5000
}
],
"object_type": "package_key",
"member": {
"created": "2012-03-07T05:00:09Z",
"updated": "2012-03-08T20:32:18Z",
"username": "partner1_dev1",
"email": "jpollock@mashery.com",
"display_name": "partner1_dev1",
"uri": "",
"blog": "",
"im": "",
"imsvc": "",
"phone": "",
"company": "",
"address1": "",
"address2": "",
"locality": "",
"region": "",
"postal_code": "",
"country_code": "",
"first_name": "",
"last_name": "",
"registration_ipaddr": "",
"area_status": "active",
"external_id": "",
"object_type": "member"
},
"application": {
"id": 80,
"created": "2013-02-19T20:55:20Z",
"updated": "2013-02-19T20:55:20Z",
"username": "partner1_dev1",
"name": "Package-based App",
"description": "",
"type": "",
"commercial": false,
"ads": false,
"ads_system": "",
"usage_model": "",
"tags": "",
"notes": "",
"how_did_you_hear": "",
"preferred_protocol": "",
"preferred_output": "",
"external_id": "",
"uri": "",
"status": "draft",
"group_id": 0,
"developer_group_handle": "",
"is_packaged": true,
"oauth_redirect_uri": "",
"object_type": "application"
},
"package": {
"id": 9,
"name": "Music API",
"description": "",
"notify_developer_period": "day",
"notify_developer_near_quota": false,
"notify_developer_over_quota": false,
"notify_developer_over_throttle": false,
"notify_admin_period": "day",
"notify_admin_near_quota": false,
"notify_admin_over_quota": false,
"notify_admin_over_throttle": false,
"notify_admin_emails": "",
"near_quota_threshold": 50,
"created": "2013-01-31T22:31:25Z",
"updated": "2013-02-12T16:49:19Z",
"key_adapter": "",
"key_length": 10,
"shared_secret_length": 0,
"status": "public",
"is_using_shared_secret": false,
"object_type": "package",
},
"plan": {
"id": 16,
"name": "Basic",
"description": "",
"notes": "",
"rate_limit_ceiling": 5000,
"rate_limit_exempt": false,
"rate_limit_order_override_allowed": true,
"rate_limit_key_override_allowed": true,
"rate_limit_period": "day",
"qps_limit_ceiling": 2,
"qps_limit_exempt": false,
"qps_limit_order_override_allowed": true,
"qps_limit_key_override_allowed": false,
"order_max": 4,
"order_moderation_threshold": 0,
"response_filter_override_allowed": true,
"created": "2013-01-31T22:31:26Z",
"updated": "2013-01-31T22:31:26Z",
"is_public": true,
"is_moderated": true,
"status": "active",
"limits": [
{
"period": "second",
"source": "plan",
"ceiling": 2
},
{
"period": "day",
"source": "plan",
"ceiling": 5000
}
],
"object_type": "plan"
}
}
Expected Response Sent from Customer-hosted Endpoint
Response Code |
HTTP status code - any non-200 response will be considered failure; future capabilities will allow for re-try of this operation if error received. Response does not impact any database operations - the data is already saved in the database and that operation cannot be rolled back due to a non-200 response - nor does it result in end-user errors. |
Content Type |
application/json |
Content |
Member JSON string (valid JSON) |
Before Deleting a Package Key
This event trigger is fired when an package key object is deleted in the Mashery platform. Package Keys can be deleted:
By the user in the My Account area of the Portal
Via the Administrative Dashboard (Package Keys tab)
Via the Mashery API.
This event trigger event is executed before the actual package key object is deleted in the Mashery database.
There are special considerations for deleting package key objects, please understand them before calling this method. When a package key object is deleted, the username associated with that member is not released. Therefore, any subsequence member.create for that same username will fail with a duplicate object error.
Event Trigger Call Structure (Mashery to Customer-hosted Endpoint)
HTTP Method |
DELETE |
Path |
/v1/package_key/<package key id> |
Parameters |
event=pre-delete&txn=<transaction id will be provided at event trigger execution time> |
Example Call:
DELETE /v1/package_key/14398445?event=pre-delete&txn=07e108fd854ae11e66b5abdf7d83585f HTTP/1.1
Host: api.customer.com
Expected Response Sent from Customer-hosted Endpoint
HTTP Response Code |
Content Type |
Content |
200 |
application/json |
{"type":"proceed"}
Example Response:
HTTP/1.1 200 OK
Server: nginx/1.3.13
Date: Fri, 05 Apr 2013 18:41:41 GMT
Content-Type: application/json
Connection: keep-alive
Vary: Accept-Encoding
X-Original-Transfer-Encoding: chunked
Content-Length: 18
{"type":"proceed"}
|
400 |
application/json |
{"type":"stop","error": {"code":-32600, "message":"<Insert error message>"}}
Example Response:
HTTP/1.1 400 Bad Request
Server: nginx/1.3.13
Date: Fri, 05 Apr 2013 18:43:57 GMT
Content-Type: application/json
Connection: keep-alive
Vary: Accept-Encoding
X-Original-Transfer-Encoding: chunked
Content-Length: 136
{"type":"stop","error": {"code":-32600, "message":"That will never work"}}
|
After Deleting a Package Key
This event trigger is fired when a package key object is created in the Mashery platform. Package Keys are created:
During the registration process (via the portal)
Via the Administrative Dashboard (Package Keys tab)
Via the Mashery API.
This event trigger event is executed after the actual package key object is deleted in the Mashery database.
Event Trigger Call Structure (Mashery to Customer-hosted Endpoint)
HTTP Method |
DELETE |
Path |
/v1/package_key/<package key id> |
Parameters |
event=post-delete&txn=<transaction id will be provided at event trigger execution time> |
Example Call:
DELETE /v1/package_key/14398445?event=post-delete&txn=07e108fd854ae11e66b5abdf7d83585f HTTP/1.1
Host: api.customer.com
Expected Response Sent from Customer-hosted Endpoint
Response Code |
HTTP status code - any non-200 response will be considered failure; future capabilities will allow for re-try of this operation if error received. Response does not impact any database operations - the data is already deleted from the database and that operation cannot be rolled back due to a non-200 response - nor does it result in end-user errors. |