Project

General

Profile

User story #6715

Add info about API

Added by Janos Mattyasovszky over 5 years ago. Updated over 5 years ago.

Status:
Released
Priority:
2
Category:
API
Target version:
Suggestion strength:
User visibility:
Effort required:

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" }
  ]
}
#1

Updated by François ARMAND over 5 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 !

#2

Updated by François ARMAND over 5 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 !

#3

Updated by Janos Mattyasovszky over 5 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).

#4

Updated by François ARMAND over 5 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

#5

Updated by Vincent MEMBRÉ over 5 years ago

  • Target version changed from 3.2.0~beta1 to 3.1.0~rc1
#6

Updated by Vincent MEMBRÉ over 5 years ago

  • Status changed from New to In progress
#7

Updated by Vincent MEMBRÉ over 5 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
#8

Updated by François ARMAND over 5 years ago

  • Description updated (diff)
#9

Updated by Vincent MEMBRÉ over 5 years ago

  • Status changed from Pending technical review to Pending release
  • % Done changed from 0 to 100
#11

Updated by Vincent MEMBRÉ over 5 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.

Also available in: Atom PDF