Post

3 followers Follow
0
Avatar

How to check is a batch is running on an app without running into rate limits?

I'd like to tell my users whether or not there's a batch running on a given app. I can easily check batches on an app, but if I was to do this, say, onece every second that would mean 3600 API requests per hour per user.

I do know the ID of the batch but there's no webhook or similar so that I could have the batch notify the user upon completion, not that I know of.

So, how would you solve this?

Timo Sillander

Please sign in to leave a comment.

2 comments

0
Avatar

Hi Timo,

When a batch completes you get an push event for the notification, which you could use to detect completion. The event looks something like this:

[{
      "data":{
         "channel":"/user/1305341",
         "data":{
            "event":"notification_create",
            "ref":{
               "type":"user",
               "id":1305341
            },
            "data":{
               "notification_id":628753005,
               "text":"Your export Foo has completed",
               "settings":{
                  "sound":false,
                  "popup":true,
                  "browser":false
               },
               "link":"https://podio.com/batches/5920018",
               "icon":"batch_complete"
            },
            "created_by":{
               "type":"system",
               "id":0
            },
            "created_via":1
         }
      },
      "clientId":"foo",
      "id":"bar"
   }
]

You can read more about push events here: https://developers.podio.com/examples/push

Best,
Andreas

Andreas Garnæs 0 votes