Skip to content

Instantly share code, notes, and snippets.

@sgur
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sgur/9150a1ddc8669e6c19b5 to your computer and use it in GitHub Desktop.
Save sgur/9150a1ddc8669e6c19b5 to your computer and use it in GitHub Desktop.
Codic Ver.3 の API (Ver.1) のサンプル
let s:access_token = 'so0RiFwQJIfvHFBdVDJa2fUyxtAwpAgTS'
let s:host = 'https://api.codic.jp'
let s:resourece = '/v1/user_projects.json'
unlet! s:resp
let s:resp = eval(webapi#http#get(s:host . s:resourece,
\ {},
\ {
\ 'Authorization' : 'Bearer ' . s:access_token
\ }).content)
if type(s:resp) != type([]) || type(s:resp[0]) != type({})
echoerr 'Error'
finish
endif
let s:project_id = s:resp[0].id
echo eval(webapi#http#get(s:host . printf('/v1/user_projects/%s.json', s:project_id)
\ , {}
\ , {
\ 'Authorization' : 'Bearer ' . s:access_token
\ }).content)
echo eval(webapi#http#get(s:host . '/v1/ced/lookup.json'
\ , {
\ 'query' : 'term'
\ , 'count' : 5
\ }
\ , {
\ 'Authorization' : 'Bearer ' . s:access_token
\ }).content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment