OpenAPI呼び出し方法
Step1:OAuth2 Access Tokenを取得
/oauth/token
APIを呼び出し、 Access Tokenを取得
curl https://[env].spendia.jp/oauth/token \
-X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-u [client_id]:[client_secret] \
-d "grant_type=client_credentials"
説明:
- 以上はcurlでの例,詳細なAPI定義はAcceeToken取得 APIを参照
- [client_id]は開発準備の企業ID
- [client_secret]は開発準備の企業キー
リターン
{"access_token":"e25c5b69-c30a-4b14-8e23-aa09fd2beac4","token_type":"bearer","expires_in":7199,"scope":"read write","tenantId":"1149296354021675010"}
リターンされた access_token
の値を取得,OpenAPIのコールに準備
Step2:OpenAPI呼び出し
部門コードで部門検索
APIを例にする
curl https://[env].spendia.jp/api/openapi/departments/by/code?departmentCode=XXX \
-H "Content-Type: application/json"
-H "Authorization: Bearer e25c5b69-c30a-4b14-8e23-aa09fd2beac4"