Build with IDX Broker › Forums › API › Basic API Questions
Tagged: api
-
AuthorPosts
-
-
Hi, I’m very new to working with the API, so I have a very basic question I’m hoping you can help with:
So there’s a certain amount of API calls per hour/day for each site.
Let’s say I have an API that pulls in the data from IDX Broker into my site, and I use that to populate a page on my site. How is an API call determined? Is an API call considered each time someone visits that page? Or is it determined some other way?
If so, would the better way be to use that API to write to the WordPress API (say a custom post type) or some other way to add to the database, and then have someway to update agents maybe once a day, and/or a button to pull in the latest data?
(+1 rating, 1 votes, rated)
You need to be a registered member to rate this post.Loading... -
When the API is called you should be storing the return. Then when the page loads you call your stored data. For WP this means adding this return into the WP database. Most often this is the WP_Options, but you can create your own table is you wish.
The update script could be once a day, but then you would have to build it outside of WP as WP doesn’t have real cron jobs. they offer a pseudo cron that runs when the WP site is visited. This WP pseudo cron would be fine for your proposed application, but you would need to store a time stamp so this also doesn’t run every page load.
Hope that helps!
(+1 rating, 1 votes, rated)
You need to be a registered member to rate this post.Loading... -
Thank you, it helps a lot. Still trying to wrap my head around things, so I’ll go through the new course and do some real world tests…I’m sure I’ll have some questions. Thanks again!
(+1 rating, 1 votes, rated)
You need to be a registered member to rate this post.Loading...
-
-
AuthorPosts
- You must be logged in to reply to this topic.