User story #6715
closedAdd info about API
Description
Please expose the Version of the API with a clean request, as currently it can only be parsed from a "free text" by setting an invalid version:
# curl -k -X GET -H 'X-API-Token: <valid_token>' -H "X-API-Version: foo" https://rudder-server/rudder/api/nodes/root {"action": "nodes","result": "error","errorDetails": "Version used does not exists, please use one of the following: [ latest, 2, 3, 4 ] "}
This should be exposed by a clean JSON answer.
This "info" endpoint should also say which API version are deprecated, so the final format may look like:
availableVersions { "latest": 6, "all": [ { "version" : 3, "status": "deprecated" } , { "version" : 4, "status": "deprecated" } , { "version" : 5, "status": "maintained" } , { "version" : 6, "status": "maintained" } ] }
Updated by François ARMAND over 9 years ago
- Assignee set to Vincent MEMBRÉ
- Priority changed from N/A to 2
- Target version set to 3.1.0~rc1
You're right, and we are going to add it in 3.1:
endpoint: I think it must be: .../api/apiversions
Needed fields:
- latest : 6
- supported : [4,5,6]
Thanks !
Updated by François ARMAND over 9 years ago
- Target version changed from 3.1.0~rc1 to 3.2.0~beta1
@Janos Matya, I'm not sur I understood the need clearly.
Do you need to have:
- a global endpoint, like ".../api/info", that gives you 1/ supported API versions for Rudder and 2/ what is latest matching to ?
- or, for each endpoint, the list of version that are supported ?
In other words, what do you want to do with that information ?
Thanks !
Updated by Janos Mattyasovszky over 9 years ago
I'd like to write a generic perl module, that does an API Abstraction, but depending on the version of the API, a different subset of features will be supported.
Since the information is already there, I'd just dump what the latest is as a simple value, and also an array of supported versions (as they define different feature sets).
Updated by François ARMAND over 9 years ago
OK, so just a global endpoint ".../api/info" with supporterVersion = [ ... ] and latest = 'XX' is sufficient.
And for you goal, are you aware that we provide a python library that does what you seem to want to do ? Of course, if perl is required, it's a no-go, but if you want to call API in scripts in an easier way, it may be what you are looking for (without knowing).
Information are here: https://github.com/Normation/rudder-api-client
Updated by Vincent MEMBRÉ over 9 years ago
- Target version changed from 3.2.0~beta1 to 3.1.0~rc1
Updated by Vincent MEMBRÉ over 9 years ago
- Status changed from New to In progress
Updated by Vincent MEMBRÉ over 9 years ago
- Status changed from In progress to Pending technical review
- Assignee changed from Vincent MEMBRÉ to François ARMAND
- Pull Request set to https://github.com/Normation/rudder/pull/872
Updated by Vincent MEMBRÉ over 9 years ago
- Status changed from Pending technical review to Pending release
- % Done changed from 0 to 100
Applied in changeset rudder|5526ab7863bf48b41dc08f8e7fb1f4061d17c1d6.
Updated by François ARMAND over 9 years ago
Applied in changeset rudder|aba0537fbfe4445ede9ff4b6b5a7484d99e1aecb.
Updated by Vincent MEMBRÉ over 9 years ago
- Status changed from Pending release to Released
This bug has been fixed in Rudder 3.1.0~rc1 which was released on the 16th June 2015.
- Announcement 3.1
- Changelog 3.1
- Download information: https://www.rudder-project.org/site/get-rudder/downloads/