Last active
August 29, 2015 14:22
-
-
Save sgur/9150a1ddc8669e6c19b5 to your computer and use it in GitHub Desktop.
Codic Ver.3 の API (Ver.1) のサンプル
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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