REST API - Timing Out

37 views
Skip to first unread message

Randy Wright

unread,
Jun 8, 2022, 12:44:16 PM6/8/22
to Zengine Development
We're using the Activities API to pull data to track the time when forms move from folder to folder. The problem we've run into is that there is so much data in the activities table that the API request is timing out. That is according to the Zengine developers. We're using the min-created parameter to limit what gets returned to us but it still times out returning a 500 Internal Server Error.

Has anyone run into a similar issue? Any suggestions on getting around this problem?

Dennis Hevener

unread,
Jun 16, 2022, 4:21:41 PM6/16/22
to Zengine Development
Hi--

Just so happens I was playing with this today , using information provided to me in this prior post:
https://groups.google.com/g/zengine-development/c/wvYF8MZ5h78/m/ca2xryIpCQAJ

As I recall, there was a followup phone call with someone at WizeHive who confirmed that the Activities endpoint, or at least the Activities endpoint with action=delete, was not working.

That still seems to be the case.

results in this:
 {"status":500,"code":5100,"userMessage":"Internal Server Error","developerMessage":"Internal Server Error","totalCount":0}

Eventually....

I added min-modified, and still the same slow response and same results.

https://api.zenginehq.com/v1/activities.json?workspace.id=9999&resource=records&min-modified=2022-06-01T00%3A00%3A00-0400&action=delete&access_token=9999

I change min-modified to modified and get back
 {"status":200,"code":2000,"totalCount":0}

Which is to be expected seeing I am specifying a time.


is a valid query, but returns nothing.

I tried action=read and still get nothing.  I am sure we read something,  I tried a few different dates to be sure.

I am sure Wes or Anna will be along to help.

Dennis

Wes

unread,
Jun 17, 2022, 9:59:41 AM6/17/22
to Zengine Development
Hello,
If you are having problems paginating all activity, try to query the activities by record id: https://api.zenginehq.com/v1/activities?limit=100&page=1&resource=records&sort%5B0%5D=created&record.id=1234

You may need to first query the form records endpoint to find the record ids, then query the activities for each record id. Make sure to make these requests sequentially - don't find 100 records and then make 100 parallel requests to the activities endpoint.

Dennis Hevener

unread,
Jun 20, 2022, 9:20:46 AM6/20/22
to Zengine Development
Hi Wes:

Sorry, I am not following this at all. You say "You may need to first query the form records endpoint to find the record ids, then query the activities for each record id. " But if the record has been deleted, will it show up on a  https://api.zenginehq.com/v1/forms/99999/records.json... request? And even if it did, I am not really buying myself anything. If I have to do that, I may as well scan every record in my SQL database and see if it exists in ZEngine or not. Or wipe everything and start over, which I have been doing.

I tried deleting a record and doing an Activities using min-modified with today's date 2022-06-20T00-00-00, and it does find it.  However, if I go to a different date there are apparently too many records and I get a 500 code 5100 error.  I tried limit=10 & page=1 to no avail. Same thing. 

Help!

Thanks,

Dennis

Wes

unread,
Jun 21, 2022, 9:42:33 AM6/21/22
to Zengine Development
Dennis,
My reply was to the original post.

Please post your problem in your original post or in a new post to keep the discussion organized. Thank you

Randy Wright

unread,
Jun 21, 2022, 11:16:51 AM6/21/22
to Zengine Development
Wes

Thanks. I verified the API call works for me if limited to a single record. However, this solution isn't very practical for me since we have nearly 5000 records to check and the API limits you to 250 calls every 5 minutes. Still, this gets me closer to where I need to be and gives me a path to explore to try to make this work. So thanks again.
Reply all
Reply to author
Forward
0 new messages