question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

REST API Versioning

See original GitHub issue

Issue

Currently there is no way to identify the Floodlight software version via the REST API. This can be an issue when trying to process Floodlight REST messages. For example, Static Flow Pusher in Floodlight v1.2 is changing to Static Entry Pusher in (upcoming) Floodlight v1.3. It would be helpful if an application could ask Floodlight for its API version before issuing commands.

Potential Solution(s)

Referencing this stackoverflow question, we see the following ant instructions will put version information in the jar’s manifest:

        <jar destfile="${floodlight-jar}" filesetmanifest="mergewithoutmain">
            <manifest>
                <attribute name="Main-Class" value="${main-class}"/>
                <attribute name="Class-Path" value="."/>
                <attribute name="Implementation-Version" value="${version}.${build.number}"/>
            </manifest>
            ...

Then, the version can be read in the code as follows: String ver = MyClass.class.getPackage().getImplementationVersion();

A resource could be attached to CoreWebRoutable that reports software version information, or maybe software version information could be provided as part of the health/json resource.

I also see some discussion of a “schema” API being added in the revision log, but I don’t know the details.

Wondering your thoughts/plans on API and/or version reporting?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rizardcommented, Jul 8, 2016

@rsharo figured out the maven issue after some debugging. The version REST API you’ve requested works now using (1) Eclipse to run… must parse pom.xml manually, (2) the jar in the build environment… read from manifest, (3) the jar on another machine… read from manifest.

curl http://localhost:8080/wm/core/version/json | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    46    0    46    0     0    353      0 --:--:-- --:--:-- --:--:--   353
{
    "name": "floodlight",
    "version": "1.2-SNAPSHOT"
}
0reactions
rsharocommented, Jul 8, 2016

@rizard Wow! Very nice work!

I’m not in a position to actually try this code yet but it all looks good by inspection.

Thanks for the very quick turnaround!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Four REST API Versioning Strategies - xMatters
1. Versioning through URI Path ... One way to version a REST API is to include the version number in the URI path....
Read more >
What is API Versioning in REST?
To manage this complexity, version your API. Versioning helps us to iterate faster when the needed changes are identified in the APIs. Change...
Read more >
Versioning a REST API - Baeldung
Evolving a REST API · In order to successfully consume the API, the Client must have prior knowledge of these Media Types ·...
Read more >
How to Version a REST API - freeCodeCamp
API versioning is the practice of transparently managing changes to your API. · Managing an API boils down to defining and evolving data ......
Read more >
API Versioning: A Marketer's Guide - HubSpot Blog
API versioning is the practice of managing changes to an API and ensuring that these changes are made without disrupting clients. A good...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found