Software AG Products 10.5 | Administering API Portal | Managing API Assets | Handling Events
 
Handling Events
Starting from 9.12 version, API Portal logs the events related to access token like key request, key renew, and key revoke in an events table. The events table also handles events related to user update and user delete.
The events mechanism has two approaches namely, Push and Pull. In the Push mechanism, the event, once saved in events table, is published to the callback URL of the key provider, whereas, in the Pull mechanism the key provider queries the events from the events table.
APIs published from CentraSite
When an API developer signs up and requests an API access token, API Portal logs the request in the local database events table with the status as NEW and sends the API developer’s sign-up or key request to CentraSite (when CentraSite is in the online mode). If CentraSite is in the offline mode, a scheduler in CentraSite polls the events database and gets the list of requests or events that are in NEW state, once it is online. Once the queried event reaches CentraSite, the status changes to INPROGRESS in the events table of API Portal.
CentraSite then generates a key, sends the key through an email to the requesting API developer and deploys the key to Mediator. Once the successful request reaches API Portal, the status of the event in the events table changes from INPROGRESS to COMPLETED. If the request is rejected in CentraSite, then the status of the event in the events table changes from INPROGRESS to REJECTED.
On receiving the email, the API developer includes the key in the application so that, at run time, when the application communicates with the virtual service at the Mediator target endpoint, Mediator calls the native service. Mediator acts as a key enforcer validating the key contained in the application’s header. In addition to key validation, Mediator also collects metrics about the application and sends that data to CentraSite for analysis and displaying the information on dashboards.
Note:
For API Portal 9.12 configured with CentraSite 9.10, the key request handling for API access tokens for the APIs published from CentraSite 9.10 to API Portal 9.12, works the same way as it did when the API was published to API Portal 9.10, except for the introduction of events table.
Querying the requests that have the status as NEW
Method: GET
EndPointURL: http://<host>:<port>/ abs/apirepository/v1/events?eventStatus=NEW
Updating the status of an event after processing
Method: POST
EndPointURL: http://<host>:<port>/ abs/apirepository/v1/events
Request payload
[
{
"eventId":"<eventId>",
"eventStatus":"ACCEPTED/REJECTED"
}
]
If the response event status is ACCEPTED then the status for the request in events table is updated to INPROGRESS, else it is moved to the status REJECTED. Events in INPROGRESS state can be queried by providers and the request processed. Once the event id is processed it moves to the COMPLETED state. The events in REJECTED and COMPLETED states are cleared based on the value provided for Events expiry days variable in the Administration > Configuration Settings page.