Skip to content

New Web API response format #164

Closed
Closed

Description

@karussell

In order to make the API more useful for navigational purposes we need a major change.

The structure will change to:

{ "info": { "some": "info", "took": 12.2 },
  "paths" : [
       {
         "distance": 1200,
         "time": 60000,
         "instructions": [ {
               "description" : "now right",
               "points": "encodedStuff0" 
            }, {
               "description" : "now left",
               "points": "encodedStuff1"
            }, ...]
       },  
       { "alternative" : "path",
         "distance": 1200,
         "time": 60000,
          ...
       }
  ]
}

a smaller change would be to just refer to the points its indices and keep only one 'points' entry in the parent:

{ "info": { "some": "info", "took": 12.2 },
  "paths" : [
       {
         "distance": 1200,
         "time": 60000,
         "instructions": [ {
               "description" : "now right",
               "intervalIndices": [0, 7]
            }, {
               "description" : "now left",
               "intervalIndices": [7, 10]
            }, ...],
            "points": "fullEncodedStuff"
       },  
       { "alternative" : "path",
         "distance": 1200,
         "time": 60000,
          ...
       }
  ]
}

This will reduce the output as no extra point information has to be stored in the instructions and we also can better refer from one instruction to the whole geometry which it follows.

Additionally it will be important to use enunciate to auto document the API and create clients automatically. Or is swagger better?

Activity

  1. added this to the 0.3 milestone on Mar 17, 2014
  2. fabrik42 commented on Mar 17, 2014

    @fabrik42

    Quick question:
    In your second proposal, shouldn't the intervalIndices of the instructions overlap?

    So instruction[i].intervalIndices[1] == instruction[i+1].intervalIndices[0]

  3. karussell commented on Mar 17, 2014

    @karussell
    MemberAuthor

    oh, sure! fixed!

  4. karussell commented on Mar 18, 2014

    @karussell
    MemberAuthor

    Hmmh, the second format would be useable without instructions too.

  5. fabrik42 commented on Mar 24, 2014

    @fabrik42

    Awesome! Any hints when this will be released?

  6. routexl commented on Apr 8, 2014

    @routexl

    This breaks backward compatibilty, right? We need to redo our interface.

  7. karussell commented on Apr 8, 2014

    @karussell
    MemberAuthor

    This breaks backward compatibilty, right?

    Yes

    We need to redo our interface.

    Not sure I understand, you only need to slightly change the parsing code ... or just keep an older version for now. Until 0.3 is released.

  8. routexl commented on Apr 8, 2014

    @routexl

    Redo may indeed be too harsh, but we definitely need to make some adjustments to our interface if we want use the new version. I noticed the endpoint changed too.

    The router really kicks ass and many thanks for that. If backward compatibility is an argument to consider for future changes, we'd be even more thankful ;-)

  9. karussell commented on Apr 8, 2014

    @karussell
    MemberAuthor

    If backward compatibility is an argument to consider for future changes, we'd be even more thankful ;-)

    You are welcome to contribute a backward compatible format or ask me to implement one via consulting, but before 1.0 I cannot give you backward compatibility guarantees although I now try to keep it.

  10. added a commit that references this issue on Dec 14, 2020
    7e93d9e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions