These are chat archives for APIs-guru/api-models

2nd
Dec 2015
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 00:07
@shaharsol I'm looking into it right now
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 00:15
@shaharsol Spotify use it

adding an inherent method of loading APIs directly from api-models

You using my REST API?

Ivan Goncharov
@IvanGoncharov
Dec 02 2015 01:09
@shaharsol I accidently post incorrect link, correct link to spotify is https://apis-guru.github.io/api-models/spotify.com/v1/swagger.yaml
shaharsol
@shaharsol
Dec 02 2015 07:48
Not via the API. adding an option to do something like commandcar load --api_model isntagram/1.0.0 and then it constructs a raw github URL accordingly and reads the yaml from there
any advantage to using the API over this method?
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 07:50
@shaharsol my is simple gh-pages which updated after each commit
so you have all benefits of gh-pages like support for CORS and gzipped content
you probably don't care about CORS
shaharsol
@shaharsol
Dec 02 2015 07:51
oh, ok. will look into that. @IvanGoncharov
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 07:52
but smaller content mean faster download
And most importantly I try to maintain stable API
but I can't say that about repo structure
I already change it once
shaharsol
@shaharsol
Dec 02 2015 07:54
@IvanGoncharov meantime had a quick look at the spotify api definition. So their securityDefinition says they're using oauth2 but nowhere does it says how to construct the authorization header, while it is explicitly mentioned in their docs. They're giving an example using Authorization: Bearer access_token
Do I have to assume that each oauth2 implementation uses that? because for example with github API it's different. They allegedly use oauth2, but the header should be Authorization: token access_token
I'm not sure the oauth2 spec dictates exactly how to construct the header, I think it is more a recommendation.
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 08:02
In any-api.com @bobby-brennan use simple rule
if flow !== 'implicit'
he use Authorization: Bearer access_token
shaharsol
@shaharsol
Dec 02 2015 08:04
this will fail with github
i.e github API
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 08:05
Funny enough I'm adding Github right now
:)
I will check
best I could found
did you tried to use Bearer
maybe it actually working
shaharsol
@shaharsol
Dec 02 2015 08:15
maybe it does. ok, i just stumbled upon it and thought other APIs will do that as well, but if 99% will uses Bearer, then I will too...
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 08:16
if not we can create custom spec extension
shaharsol
@shaharsol
Dec 02 2015 08:16
does swagger supports templating in headers?
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 08:17
I use it only as last resort
shaharsol
@shaharsol
Dec 02 2015 08:18
ok, thanks for all your help. already changed to using your API btw instead raw github
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 08:18
but if it choice of having popular API
or not
I will do vendor extension
Also it's better to use ID's from list.json
instead of paths to identify APIs
same motivation I will maintain ID's stable
Also good idea is to make command which list all supported IDs
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 08:24
@shaharsol if you interested I can also add host and basePath into list.json
This will allow fuzzy matching APIs
commandcar load --api_model --fuzzy api.github.com
or any other API
commandcar load --api_model --fuzzy *.googleapis.com
to install all google APIs
I think it's better way of addressing API
because I have complicated rules for choosing paths and IDs
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 08:30
Just throwing some ideas
shaharsol
@shaharsol
Dec 02 2015 08:51
i beleive developers would want to be specific about APIs and versions. I look into how i can use the list.json and add a search command instead of sending them to github to browse the repository
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 08:52
versions almost always mentioned either in host or in basePath
so https://api.spotify.com/v1/ for example is one to one match
same for other APIs
but I'm only suggesting
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 08:59
I would actually like users visiting my repo :)
but it make less "one click" experience that it could be
shaharsol
@shaharsol
Dec 02 2015 12:55
I think I'll start with the repo and if there's demand I'll add list and search commands
@IvanGoncharov another issue, I'm trying to test a POST request. I used to do it with Google Drive api, POSTing into /files. It works with adding Content-Type and Content-Length to the headers, and uploadType=media to the query. I can't find neither in [https://github.com/APIs-guru/api-models/blob/master/APIs/googleapis.com/drive/v2/swagger.yaml]. Is that because the swagger is not complete or because I'm missing something?
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 12:59
@shaharsol I will look into it
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 13:21
@shaharsol it's a problem on my side
The biggest problem is path /upload/drive/v2/files?uploadType=media
so it's add /upload prefix
swagger file can have only one baseUrl
which is /drive/v2 for this API
@shaharsol What do you think if I create additional files alongside with swagger.yaml something like upload-swagger.yaml
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 13:26
which will have only different basePath
and operations which use it
I also will add array of links to such files into appropriate entries in list.json
@shaharsol Will this works for you?
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 13:39
@shaharsol How critical this issue for you?
shaharsol
@shaharsol
Dec 02 2015 14:04
@IvanGoncharov oh its not critical specifically for the Google Drive api. It was just easy on my end to use it to test POSTs. I'll need to find something else.
shaharsol
@shaharsol
Dec 02 2015 14:14
you dont have a dropbox api swagger by any chance?
its classic for testing oauth2 POSTs
here is Dropbox
but only v1
shaharsol
@shaharsol
Dec 02 2015 14:17
sweet!
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 14:17
It it works, write to me and will add it to collection
I don't want to add it until I find out that Dropbox still support v1
shaharsol
@shaharsol
Dec 02 2015 14:18
they do afaik, v2 is only in beta
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 14:18
cool
I will add it today
shaharsol
@shaharsol
Dec 02 2015 14:19
hehe double check it before u do
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 14:19
ok
can you open issue about support of file uploads in google apis?
so I don't forget about it
shaharsol
@shaharsol
Dec 02 2015 14:21
maybe later, got to run. will be back on it tonight. what time zone are you in?
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 14:32
Ukraine GMT+2
shaharsol
@shaharsol
Dec 02 2015 19:18
same here, Israel GMT+2
shaharsol
@shaharsol
Dec 02 2015 20:06
ok, it worked with dropbox! just created a dropbox folder via the command line ;-)
Ivan Goncharov
@IvanGoncharov
Dec 02 2015 20:56
@shaharsol You used v1 API?
I will add it first thing in the morning