Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common url parameters for all requests #274

Closed
bazo opened this issue Sep 30, 2015 · 8 comments
Closed

Common url parameters for all requests #274

bazo opened this issue Sep 30, 2015 · 8 comments

Comments

@bazo
Copy link

bazo commented Sep 30, 2015

Hi,

our api requires that client add an apiKey, signature and timestamp as a query string to every request

so i have to repeat this query part in every resource definition like this

## Client [/clients/{id}?apiKey={apiKey}&signature={signature}&timestamp={timestamp}]

and then parameters

+ Parameters
    + apiKey (required, string, `2961654ce6c3d01c79edc98c8d930d4cc663cda4`) 
    + signature (required, string, `213213jjflkjdsfl343k4jjfdsdsf`) 
    + timestamp (required, integer, `1443620910`) 

since we have endpoints operating on collections and then on single resource, i have to copy paste this for every group at least twice and then modify the url templates which take some additional query params

when you have a lot of resource group this gets quite tedious, and if you add another common required query param, you have to update everything

i suggest adding some commonParams section to the top of blueprint document and these parameters would be then applied to all requests

@kylef
Copy link
Member

kylef commented Sep 30, 2015

Hi @bazo, while this isn't currently supported. We do have a proposal for this in apiaryio/api-blueprint-rfcs#3 (https://github.com/apiaryio/api-blueprint-rfcs/blob/zdne/mson-parameters/draft/mson-parameters-headers.md#parameters). It's a planned feature.

Where you can reference and inherit from other parameters.

# Resource [/resource/{client}{?signature,apiKey,timestamp}]
+ Parameters (Authentication)
    + client: foo

# Data Structures
## Authentication (Parameters)
+ apiKey: 2961654ce6c3d01c79edc98c8d930d4cc663cda4 
+ signature: 213213jjflkjdsfl343k4jjfdsdsf
+ timestamp: 1443620910 (integer)

@kylef kylef closed this as completed Sep 30, 2015
@pksunkara
Copy link
Contributor

I think he has a good question in here:

so i have to repeat this query part in every resource definition like this

@zdne What do you think? Can we do something about repeating of the uri template?

@pksunkara
Copy link
Contributor

I am really tempted to reopen this issue. I think this issue is more about defining common parameters for more than 1 resource and less about using MSON style syntax.

@zdne Would really love it if you can provide an opinion on this.

@kylef
Copy link
Member

kylef commented Oct 2, 2015

Being able to define these in some kind of custom authentication scheme would be ideal. Similar to https://github.com/apiaryio/api-blueprint-rfcs/blob/kylef/authentication-oauth2/draft/authentication-oauth2.md.

@pksunkara
Copy link
Contributor

That's okay if they are Authentication related parameters. I am talking about other parameters such as page, per_page etc.. Basically anything that can be used for all resources.

@borekb
Copy link

borekb commented Nov 4, 2016

Would use this as well.

@varenc
Copy link

varenc commented Nov 22, 2016

@kylef the link you referenced in your October 1, 2015 comment no longer works. Advice on convenient ways to specify that every endpoint requires an OAuth 2 bearer token would be appreciated.

@jars
Copy link

jars commented Nov 7, 2017

Any update on this?

Having Parameters act like Attributes in their ability to do simple inheritance from a centralised data-structures.md would make our blueprints code-base much more maintainable/DRY.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants