API Requests
-
Some of you know that I am working on a jobboard component for BP. It’s going really well, actually, but it’s not the reason for this post. At the moment I work with the RESTful API of the component. Basically, I want external sites to be able to pull in data for their sites while querying my database.
Staying with the example of a jobboard, companies could for example display their latest job vacancies (we could turn this into a widget for external WP blogs for example). They could do it by getting the contents of this url:
http://mysite.com/api/xml/company/3/10/AJDF99374HEM/Now, I would like to agree on an api scheme for all the components out there. My example here works like this at the moment:
site url: http://mysite.com/
api namespace: api/ (this is a reserved name)
format: xml/ (could be xml, json or php (for serialized php) , or whatever you specify)
method: company/ (get all for a group in this case, could also be a member or whatever your component requires)
method variable: 3/ (in this case it would be the group id)
2. method variable: 10/ (this would be the amount of jobs to get)
api key: AJDF99374HEM/This works really well for me, except that I thought of the other components out there.
We could all implement our own scheme if we injected the components name right after the api namespace. In my case, the URL to get the data would read like this:
http://mysite.com/api/jobboard/xml/company/3/10/AJDF99374HEM/What do you think?
- The topic ‘API Requests’ is closed to new replies.