The Swagger JS client can do it, but may take this a bit further than what you are asking for. Requires your API to expose swagger spec compliant JSON to describe the web services.
Document API with this: https://github.com/wordnik/swagger-spec/ Then point the js client to API https://github.com/wordnik/swagger-js Bonus, after those two steps: https://github.com/wordnik/swagger-ui In addition to js, generate other clients: https://github.com/wordnik/swagger-codegen -- Levi > On Aug 1, 2014, at 3:37 PM, Paul <[email protected]> wrote: > > So i've been looking for a REST client that lets you specify path parameters > the same way that express handles routes with params in them. > > I've been superagent for most of my http needs, but I want something that > goes one step further and automatically handles the encoding/replacing of > parameters. > > Ideally I'd be able to do something like this with a request builder: > > var path = "/users/:userId/things/:thingName/:optionalParam?"; > var params = { userId: 1, thingName: "My Super Thing & Stuff"; } > var query = { search: "my search", type: 1 }; > > rest.get() > .base('http://api.example.com') > .path(path, params) > .query(query) > .accept('json') > .end(function() {}); // actually execute the request > > > This would execute a request to: > > http://api.example.com/users/1/things/My%20Super%20Thing%20%26%20Stuff?query=my%20search&type=1 > > What do people use for calling REST apis, besides manually constructing the > URL by concatenating/encoding things? > > I'd expect something like this to exist already, so before I make it I wanted > to check with the community. > -- > Job board: http://jobs.nodejs.org/ > New group rules: > https://gist.github.com/othiym23/9886289#file-moderation-policy-md > Old group rules: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/nodejs/a1db38d0-6c20-4758-a072-b514f83b663c%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/28B38221-1BE1-4355-9643-1E2070D1897B%40calmdev.com. For more options, visit https://groups.google.com/d/optout.
