Before Creating a Application
This event trigger is fired when an application object is created in the Mashery platform. Applications are created:
During the registration process (via the portal)
Via the Administrative Dashboard (Applications tab)
Via the Mashery API.
This event trigger event is executed before the actual application object is saved in the Mashery database. As such, data can be enriched, e.g. adding data from your own systems into the Mashery application 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/application |
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 application object. This is determined by the setting found in the Integration tab of Portal Settings in the Mashery Console. |
Example Call:
POST /v1/application?event=pre-create&txn=c2e6e0c021fcec539b0f29b93d422f36 HTTP/1.1
Host: api.customer.com
Accept: application/json
Application-Agent: Mashery Event Trigger 1.0
Content-Type: application/json
{
"member": {
"region": "",
"external_id": "",
"phone": "",
"address1": "",
"address2": "",
"area_status": "active",
"registration_ipaddr": "",
"blog": "http://blog.mashery.com",
"im": "",
"country_code": "",
"uri": "http://www.mashery.com",
"object_type": "member",
"first_name": "Event Trigger",
"display_name": "event triggerTester",
"username": "event triggerTester",
"created": "2012-10-09T15:34:50Z",
"updated": "2012-10-09T17:54:40Z",
"email": "jpollock@mashery.com",
"postal_code": "",
"company": "Mashery",
"last_name": "Test",
"locality": "",
"imsvc": ""
},
"preferred_protocol": "",
"tags": "",
"external_id": "",
"status": "draft",
"ads_system": "",
"type": "",
"uri": "",
"object_type": "application",
"username": "event triggerTester",
"preferred_output": "",
"created": "2012-10-09T17:54:41Z",
"updated": "2012-10-09T17:54:41Z",
"how_did_you_hear": "",
"description": "",
"usage_model": "",
"name": "Test App for event triggerTester",
"ads": false,
"notes": "",
"commercial": false
}
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": [{"description": "This is a custom description from my back-end system."}]}
|
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":"name","message":"Invalid application name"}]}}
|
After Creating a Application
This event trigger is fired when a applicationobject is created in the Mashery platform. Applications are created:
During the registration process (via the portal)
Via the Administrative Dashboard (Applications tab)
Via the Mashery API.
This event trigger event is executed after the actual application object is saved in the Mashery database.
Event Trigger Call Structure (Mashery to Customer-hosted Endpoint)
HTTP Method |
PUT |
Path |
/v1/application/<application 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 application object. This is determined by the setting found in the Integration tab of Portal Settings in the Mashery Console. |
Example Call:
PUT /v1/application/146078?event=post-create&txn=c2e6e0c021fcec539b0f29b93d422f36 HTTP/1.1
Host: api.customer.com
Accept: application/json
Application-Agent: Mashery Event Trigger 1.0
Content-Type: application/json
{
"member": {
"region": "",
"external_id": "",
"phone": "",
"address1": "",
"address2": "",
"area_status": "active",
"registration_ipaddr": "",
"blog": "http://blog.mashery.com",
"im": "",
"country_code": "",
"uri": "http://www.mashery.com",
"object_type": "member",
"first_name": "Event Trigger",
"display_name": "event triggerTester",
"username": "event triggerTester",
"created": "2012-10-09T15:34:50Z",
"updated": "2012-10-09T17:54:40Z",
"email": "jpollock@mashery.com",
"postal_code": "",
"company": "Mashery",
"last_name": "Test",
"locality": "",
"imsvc": ""
},
"preferred_protocol": "",
"tags": "",
"external_id": "",
"status": "draft",
"ads_system": "",
"type": "",
"uri": "",
"object_type": "application",
"username": "event triggerTester",
"preferred_output": "",
"created": "2012-10-09T17:54:41Z",
"updated": "2012-10-09T17:54:41Z",
"how_did_you_hear": "",
"description": "",
"usage_model": "",
"name": "Test App for event triggerTester",
"ads": false,
"notes": "",
"commercial": false
}
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. |
Before Updating a Application
This event trigger is fired when an application object is updated, or modified, in the Mashery platform. Applications are updated:
By the user in the Portal My Account area
Via the Administrative Dashboard (Applications tab)
Via the Mashery API.
This event trigger event is executed before the actual application object is saved in the Mashery database. As such, data can be enriched, e.g. adding data from your own systems into the Mashery application 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/application/<application 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 application object. This is determined by the setting found in the Integration tab of Portal Settings in the Mashery Console. |
Example Call:
PUT /v1/application/146078?event=pre-update&txn=7e59ae42a7279a0bec2bedea237d2adb HTTP/1.1
Host: api.customer.com
Accept: application/json
Application-Agent: Mashery Event Trigger 1.0
Content-Type: application/json
{
"member": {
"region": "",
"external_id": "",
"phone": "",
"address1": "",
"address2": "",
"area_status": "active",
"registration_ipaddr": "",
"blog": "http://blog.mashery.com",
"im": "",
"country_code": "",
"uri": "http://www.mashery.com",
"object_type": "member",
"first_name": "Event Trigger",
"display_name": "event triggerTester",
"username": "event triggerTester",
"created": "2012-10-09T15:34:50Z",
"updated": "2012-10-09T17:54:40Z",
"email": "jpollock@mashery.com",
"postal_code": "",
"company": "Mashery",
"last_name": "Test",
"locality": "",
"imsvc": ""
},
"preferred_protocol": "",
"tags": "",
"external_id": "",
"status": "draft",
"ads_system": "",
"type": "",
"uri": "http://www.mashery.com",
"object_type": "application",
"id": 146082,
"username": "event triggerTester",
"preferred_output": "",
"how_did_you_hear": "",
"created": "2012-10-09T17:54:41Z",
"updated": "2012-10-09T17:58:21Z",
"description": "This is a great application",
"usage_model": "",
"name": "Test App for event triggerTester",
"ads": false,
"notes": "",
"commercial": false
}
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": [{"description": "This is a custom description from my back-end system."}]}
|
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":"name","message":"Invalid application name"}]}}
|
After Updating a Application
This event trigger is fired when an updated, or modified, application object is saved in the Mashery platform. This event trigger event is executed after the actual application object is saved in the Mashery database.
Event Trigger Call Structure (Mashery to Customer-hosted Endpoint)
HTTP Method |
PUT |
Path |
/v1/application/<application 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 application object. This is determined by the setting found in the Integration tab of Portal Settings in the Mashery Console. |
Example Call:
PUT /v1/application/146078?event=post-update&txn=7e59ae42a7279a0bec2bedea237d2adb HTTP/1.1
Host: api.customer.com
Accept: application/json
Application-Agent: Mashery Event Trigger 1.0
Content-Type: application/json
{
"member": {
"region": "",
"external_id": "",
"phone": "",
"address1": "",
"address2": "",
"area_status": "active",
"registration_ipaddr": "",
"blog": "http://blog.mashery.com",
"im": "",
"country_code": "",
"uri": "http://www.mashery.com",
"object_type": "member",
"first_name": "Event Trigger",
"display_name": "event triggerTester",
"username": "event triggerTester",
"created": "2012-10-09T15:34:50Z",
"updated": "2012-10-09T17:54:40Z",
"email": "jpollock@mashery.com",
"postal_code": "",
"company": "Mashery",
"last_name": "Test",
"locality": "",
"imsvc": ""
},
"preferred_protocol": "",
"tags": "",
"external_id": "",
"status": "draft",
"ads_system": "",
"type": "",
"uri": "http://www.mashery.com",
"object_type": "application",
"id": 146078,
"username": "event triggerTester",
"preferred_output": "",
"how_did_you_hear": "",
"created": "2012-10-09T17:54:41Z",
"updated": "2012-10-09T17:58:21Z",
"description": "This is a great application",
"usage_model": "",
"name": "Test App for event triggerTester",
"ads": false,
"notes": "",
"commercial": false
}
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. |
Before Deleting a Application
This event trigger is fired when an application object is deleted in the Mashery platform. Applications can be deleted:
By the user in the My Account area of the Portal
Via the Administrative Dashboard (Applications tab)
Via the Mashery API.
This event trigger event is executed before the actual application object is deleted in the Mashery database.
There are special considerations for deleting application objects, please understand them before calling this method. When a application 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/application/<application id> |
Parameters |
event=pre-delete&txn=<transaction id will be provided at event trigger execution time> |
Example Call:
DELETE /v1/application/146078?event=pre-delete&txn=fee6441aa6455470044328823113efce 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>","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"}}
|
After Deleting a Application
This event trigger is fired when a application object is created in the Mashery platform. Applications are created:
During the registration process (via the portal)
Via the Administrative Dashboard (Applications tab)
Via the Mashery API.
This event trigger event is executed after the actual application object is deleted in the Mashery database.
Event Trigger Call Structure (Mashery to Customer-hosted Endpoint)
HTTP Method |
DELETE |
Path |
/v1/application/<application id> |
Parameters |
event=post-delete&txn=<transaction id will be provided at event trigger execution time> |
Example Call:
DELETE /v1/application/146078?event=post-delete&txn=fee6441aa6455470044328823113efce 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. |