Retrieving failed events

You can retrieve the failed events that are not published to the configured endpoints by using REST API endpoints.

When the application cannot publish events to the configured endpoints like IBM Cloud® Object Storage or webhooks, you can download the failed events by using REST API. These events are available for three days after which they are purged.

Two REST API endpoints are available for retrieving failed events. You can open an IBM® Support case and request for the tenant configuration and REST API endpoints information.

To retrieve failed events, you can implement a process to periodically extract data from the endpoint to monitor for any failed events. You can extract as frequently as needed to ensure that you do not miss any failed events.

Fetching failed events

Remember:
  • You must ensure to have access to the failed event authorization key or have the endpoint IDs.
  • If you do not have access to the failed event authorization key or do not have the endpoint IDs, open a ticket with IBM Support and request for the keys or endpoint IDs. To open a ticket, see IBM Support.

Procedure

  1. Call one of the following APIs to get the first 100 event files.
    • To get event files regardless of endpoint:
      curl --request GET \
      --url https://api.data-exchange.na.oms.supply-chain.ibm.com/v1/failed-event-files \
      --header 'authorization: Bearer <auth_key_for_failed_events_api>' \
      --header 'content-type: application/json'
    • To get event files from a particular endpoint:
      curl --request GET \
      --url https://api.data-exchange.na.oms.supply-chain.ibm.com/v1/failed-event-files/endpoints/<endpoint ID> \
      --header 'authorization: Bearer <auth_key_for_failed_events_api>' \
      --header 'content-type: application/json'
      Sample output data:
      [
        {
           "endpointId": " eb188627-4556-410b-84a7-7b1b47da204e",
           "fileName": " eb188627-4556-410b-84a7-7b1b47da204e_2022-01-25T183415Z_96alBB1.zip",
           "downloadFileUrl": "https://s3.us-east.cloud-object-storage.appdomain.cloud/<failed event one time URL>",
           "urlExpiryInSeconds": "43200",
           "creationTimestamp": "Tue Jan 25 18:34:16 UTC 2022"
        }
        {
           "endpointId": " eb188627-4556-410b-84a7-7b1b47da204e",
           "fileName": " eb188627-4556-410b-84a7-7b1b47da204e_2022-01-25T183415Z_96alBB1.zip",
           "downloadFileUrl": "https://s3.us-east.cloud-object-storage.appdomain.cloud/<failed event one time URL>",
           "urlExpiryInSeconds": "43200",
           "creationTimestamp": "Tue Jan 25 18:34:16 UTC 2022"
        }
      ]
      Note: An empty array indicates that there are no files currently available to download. This call returns one of the first 100 event files in the pull queue for an endpoint. The new events are returned after the earlier events are deleted.
  2. Get each event file that was returned in the previous step and download the event file locally.
    curl <downloadFileUrl> --output <filename>
  3. After the file is saved, delete the event files on the endpoint.
    curl --request DELETE \
    --url https://api.data-exchange.na.oms.supply-chain.ibm.com/v1/failed-event-files \
    --header 'authorization: Bearer <auth_key_for_failed_events_api>' \
    --header 'content-type: application/json' \
    --data-raw '["filename1","filename2"]'
  4. Repeat the steps until all the messages are downloaded.