Example asynchronous user event notification flow
An example of an asynchronous event notification flow is shown below using a user assignment.
- Company Administrator Alice assigns a seat to user Bob. This action creates an event identified by URL https://www.acme-marketplace.com/api/integration/v1/events/12345.
- AppDirect calls http://example.com/assign?url=https%3A%2F%2Fwww.acme-marketplace.com%2Fapi%2Fintegration%2Fv1%2Fevents%2F12345.
- Example.com issues an event notification to: https://www.acme-marketplace.com/api/integration/v1/events/12345\. If Example.com wants to receive the response from AppDirect in JSON format, they must add
Accept: application/json
in their HTTP GET request. If they want to receive the response from AppDirect in XML format they must addAccept: application/xml
in their HTTP GET request. If they do not specify the content type an XML payload will be returned. - AppDirect sends a JSON or XML response to the vendor.
- JSON
{
"type": "USER_ASSIGNMENT",
"marketplace": {
"baseUrl": "https://www.acme.com",
"partner": "APPDIRECT"
},
"creator": {
"email": "387a2e29-1dec-4ed0-b945-c9b4cf52381c",
"firstName": "Another",
"language": "en",
"lastName": "User",
"locale": "en-US",
"openId": "https://www.acme.com/openid/id/b358dac2-da0c-40f2-a187-f7a34f183163",
"uuid": "b358dac2-da0c-40f2-a187-f7a34f183163"
},
"payload": {
"account": {
"accountIdentifier": "202827",
"status": "ACTIVE"
},
"user": {
"email": "387a2e29-1dec-4ed0-b945-c9b4cf52381c",
"firstName": "Another",
"language": "en",
"lastName": "User",
"locale": "en-US",
"openId": "https://www.acme.com/openid/id/b358dac2-da0c-40f2-a187-f7a34f183163",
"uuid": "b358dac2-da0c-40f2-a187-f7a34f183163"
}
}
}- XML
<?xml version="1.0" encoding="UTF-8" ?>
<event>
<type>USER_ASSIGNMENT</type>
<marketplace>
<baseUrl>https://www.acme.com</baseUrl>
<partner>APPDIRECT</partner>
</marketplace>
<creator>
<email>387a2e29-1dec-4ed0-b945-c9b4cf52381c</email>
<firstName>Another</firstName>
<language>en</language>
<lastName>User</lastName>
<locale>en-US</locale>
<openId>https://www.acme.com/openid/id/b358dac2-da0c-40f2-a187-f7a34f183163</openId>
<uuid>b358dac2-da0c-40f2-a187-f7a34f183163</uuid>
</creator>
<payload>
<account>
<accountIdentifier>202827</accountIdentifier>
<status>ACTIVE</status>
</account>
<user>
<email>387a2e29-1dec-4ed0-b945-c9b4cf52381c</email>
<firstName>Another</firstName>
<language>en</language>
<lastName>User</lastName>
<locale>en-US</locale>
<openId>https://www.acme.com/openid/id/b358dac2-da0c-40f2-a187-f7a34f183163</openId>
<uuid>b358dac2-da0c-40f2-a187-f7a34f183163</uuid>
</user>
</payload>
</event> - Example.com starts the creation of a new user for Bob in its account system.
- Example.com returns an XML response to the original HTTP request.
- JSON
Status Code: 202 Accepted
{
"success":true
}- XML
Status Code: 202 Accepted
<result>
<success>true</success>
</result> - AppDirect puts the user assignment into a pending state (PENDING_USER_ACTIVATION). The user cannot do anything with the subscription at this time.
- The vendor sends an HTTP POST to https://www.acme-marketplace.com/api/integration/v1/events/12345/result to indicate the account creation is complete. Note that the POST body is the same object as a synchronous event response.
- JSON
Status Code: 200 OK
{
"success":true
}- XML
Status Code: 200 OK
<result>
<success>true</success>
</result>
In the event of an error, Example.com must return a valid error code, see Event error codes.
- JSON
Status Code: 400 Bad Request
{
"success": "false"
"errorCode": "MAX_USERS_REACHED"
"message": "Optional message about the max users being reached"
}
- XML
Status Code: 400 Bad Request
<result>
<success>false</success>
<errorCode>MAX_USERS_REACHED</errorCode>
<message>Optional message about the max users being reached</message>
</result>
Was this page helpful?
Tell us more…
Help us improve our content. Responses are anonymous.
Thanks
We appreciate your feedback!