GithubHelp home page GithubHelp logo

non-query string parameters about iodocs HOT 6 OPEN

mashery avatar mashery commented on August 19, 2024
non-query string parameters

from iodocs.

Comments (6)

kmiyashiro avatar kmiyashiro commented on August 19, 2024

@kmayoral: Can you give me an example of that? Like say,

http://api.acme.com/:required/:optional and if :optional is blank, it sends http://api.acme.com/bob/:optional? Would it make more sense to treat the optional param as another resource/method?

Example:

http://api.acme.com/:resource - Return all from resource
http://api.acme.com/:resource/:specific - Return a specific item from resource

http://api.acme.com/users - All users
http://api.acme.com/users/bob - Just bob

from iodocs.

kmayoral avatar kmayoral commented on August 19, 2024

kmiyashiro - yup your example is exactly what I was bringing up. You're right that creating another resource/method could solve the problem easily, but I guess it'd be more of a convenience to have both cases be handled by the same resource/method if they relate to the same type of request.

I guess as an example, if there was a method to retrieve a paginated list of items from a gallery of sorts, you could optionally specify :optional_start_page to state the page you want to start retrieving items from, but if left unspecified, it would default to returned the first page.
http://api.acme.com/gallery/:optional_start_page

These cases could be split into two different resource/method entries in the system, but it would just be convenient to be handle them in one case to avoid duplication in the API view page.

That being said, you did bring up a working alternative approach for my original issue (creating another method), so if this request isn't implemented, it won't hurt the functionality of the system.

Thanks for hearing me out though!

from iodocs.

kmiyashiro avatar kmiyashiro commented on August 19, 2024

Yeah, shouldn't be too hard to add. I also noticed we don't have client-side validation for required fields which is kind of related.

from iodocs.

gggeek avatar gggeek commented on August 19, 2024

It would be nice to get more docs about support for non-query-string parameters (in README.md).
Right now there is no example of such possibility, which makes the casual user think it is not supported

from iodocs.

smgilson avatar smgilson commented on August 19, 2024

I have the same issue as originally posted, I want to be able to generate a URI in the from: "/api/test/get/:param1"

But, I can't tell from this thread if it has been made possible and, if so, how to do it.

Thanks

from iodocs.

catapultsoftworks avatar catapultsoftworks commented on August 19, 2024

I'd also like to be able to make restful parameters optional without resorting to another resource. I should be able to do /pets and /pets/123 in the same resource definition. Is there a way to do this?

from iodocs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.