Home » News » New API Release: Recover Account Activity Events

New API Release: Recover Account Activity Events

@tony wrote:

Today, we are excited to announce the launch of the Account Activity Replay API, a data recovery tool available to enterprise customers with access to the Account Activity API. This product allows users to retrieve missed events from as far back as five days ago.

This new tool can be utilized to recover data in scenarios where your webhook server misses or drops events. This can be due to webhook server unresponsiveness or disconnection lasting longer than the retry window, or for those disaster recovery scenarios where you need a few days to restore your system back to normal.

The Account Activity Replay API was developed for any scenario where you fail to ingest activities for a period of time. It delivers activities to the same webhook used for the original real-time delivery of activities. This product is a recovery tool and not a backfill tool, which means that events will only be replayed if they were attempted previously.

We’re excited to offer this data recovery tool to enterprise customers. Please feel free to ask questions via the Premium category. Additionally, you can take a look at our sample app on Github for the enterprise Account Activity API if you need help getting started.

Example curl command:

curl --request POST  --url "https://api.twitter.com/1.1/account_activity/replay/webhooks/:webhook_id/subscriptions/all.json?fromDate=yyyymmddhhmm&toDate=yyyymmddhhmm"
--header 'authorization: Bearer TOKEN'

This will yield the following result:

HTTP 202
{
  "job_id": "1234567890",
  "created_at": "2016-06-02T23:54:02Z"
}

At this point, a Replay job has been created and events will start being delivered to the webhook URL associated with the webhook ID specified in the curl command.

Once the job successfully completes, Account Activity Replay API will deliver the following job completion event. Once this event is received on the webhook, the job has finished running and another can be submitted.

{
  "replay_job_status": {
    "webhook_id": "1234577122340233217",
    "job_state": "Complete",
    "job_state_description": "Job completed successfully"
    "job_id": "1095098195724558337"
  }
}

“Job failed to complete” Message

In the event the job does not complete successfully, the Replay API will return the following message and the Replay job should be retried. Once this event is received on the webhook, the job has finished running and another can be submitted.

{
  "replay_job_status": {
    "webhook_id": "123451374207332352",
    "job_state": "Incomplete",
    "job_state_description": "Job failed to deliver all events, please retry your       replay job",
    "job_id": "1093226942650736640"
  }
}

Posts: 2

Participants: 1

Read full topic

source https://twittercommunity.com/t/new-api-release-recover-account-activity-events/126017

Leave a Reply