Using the wordpress.org API
-
I am trying to use the wordpress.org API to be able to check version numbers of plugins found on .org. I have looked at the docs but there is very little information about using the plugin API. I am trying to use version 1.2 because it uses GET requests and I am using CURL to hit the API. But there doesn’t seem to be any reference for what fields are acceptable or how to format the request.
Based on the documentation that was linked to (here, and here) I have tried the following without any luck.
https://api.wordpress.org/plugin/info/1.2/?action=plugin_information&request%5Bslug%5D=ninja-formshttps://api.wordpress.org/plugins/info/1.2/?action=plugin_information&reqest[slug]=ninja-formshttps://api.wordpress.org/plugins/info/1.2/?action=plugin_information&slug=ninja-formshttps://api.wordpress.org/plugins/info/1.2/ninja-forms/?action=plugin_informationThe closest I got was with this:
https://api.wordpress.org/plugins/info/1.2/?action=plugin_information
but I get this as a response:
{"error":"Plugin slug not provided."}I also looked at the plugins_api() as a reference and tried to reverse engineer how it might work (which is where I got the attempt at the top of the list above from) but am having no luck.
I’m not sure where else to look and have no idea how the formatting for this is meant to work so a bit of help would be greatly appreciated.
Thanks!
-
This topic was modified 6 years, 5 months ago by
yoxalld.
-
This topic was modified 6 years, 5 months ago by
-
You have a typo in request π
https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&request[slug]=ninja-formsWorks.
You had reqest
A somewhat simpler means is to use the older 1.0 endpoints.
https://api.wordpress.org/plugins/info/1.0/ninja-forms.json
For example.
Towards what end? What are you trying to do with the version number? There may be an easier way already (like using the update check API…)
The version is in that default response, right after the slug.
If you want to reduce the amount of default data you get back, you can send what fields to exclude like so:
https://api.wordpress.org/plugins/info/1.0/ninja-forms.json?fields=-added,-compatibility,-downloaded,-description,-download_link,-donate_link,-homepage,-last_updated,-rating,-ratings,-requires,-requires_php,-sections,-short_description,-tags,-tested,-icons,-active_installs,-banners,-reviews,-contributorsThat is about as much removal of those as you can do.
@ipstenu I am trying to set up some automated events with my local environment and it’s being done via bash scripting so the php api calls aren’t an option.
@otto42 that could work. I can parse out the single piece of information I need from the larger set. I just wanted to make sure there wasn’t a simpler way to just ask for the piece of information I needed. The documentation was very sparse so it wasn’t clear what was available.
It seems like version 1.2 would have the ability to request only specific pieces of info, but again there is no documentation so I don’t know how the API is set to respond.
The API is set to respond to queries from the WordPress software. It’s not meant for general public usage or to be a general way into our systems.
If you need the data, you’re welcome to it, but it isn’t intended for you or your batch inquiries, it is intended for WordPress installs to get the data they need to display things to users.
Itβs not meant for general public usage or to be a general way into our systems.
@otto42, it might be worth adding this to the description at the top of https://codex.wordpress.org/WordPress.org_API. Currently it isn’t clear, and could help to curb expectations. Speaking from my own perspective, finding this thread has made me change direction for a particular project which would have used the API in an unsuitable way.
@philclothier We’re okay with the existing wording.
Hello,
Could someone help me out with this API code?
Would like (if possible) to add this to a custom html widget box in the Footer.Public API V1
Overview
The YEM Exchange API v1 is a basic REST API that users can use to retrieve market data. The API, for ease, is mostly compatible with similar simple APIs made by other major exchanges. API calls are limited to 2 requests per second, with any request exceeding the rate limit denied by an https 503 response. All API responses are valid JSON arrays.
API Functions
1. Market Stats
2. Live Trading Data
3. Live Order Book DataMarket Stats
https://yemexchange.com/statistics.php?pair={COIN}-{EXCHANGE}
Function: Provides stats for a single specific market. Data Refresh: every minute.Example: https://yemexchange.com/statistics.php?pair=YEM-USD
JSON Response
{
“status”:”ok”,
“LastTrade”:”2.200″,
“24hourHigh”:”2.200″,
“24hourLow”:”2.123″,
“24hourVolume”:”1056732.62″
}Thank you very much,
Marc
The topic ‘Using the wordpress.org API’ is closed to new replies.