Show page source of APIGuide #104871

= OSDN API

OSDN REST API is currently experimental beta.
Documentation is not yet completed.

== API Explorer

Currently, we do not provide detailed API references yet. 
Please refer [https://osdn.jp/swagger-ui/ API Explorer by swagger-UI] to get function list.
== Application registration

You can register your application with [https://osdn.jp/account/oauth2ui/apps your account page].

== Authentication

OSDN API authentication is based on [http://oauth.net/2/ OAuth2].

=== Auth code grant

First your application need to route user to OSDN auth URL ( https://osdn.jp/account/oauth2ui/authorize ) with following query parameters;

 * client_id: application ID you registered
 * state: OAuth state string
 * response_type: set as 'code'
 * scope: (optional) space separated scopes. Currently avaiable scopres are  ''profile'', ''group'', ''group_write'', ''chamber'' and ''chamber_write''. Default is ''profile''.

If user allow your application to access user account, they will be redirected back to your application with ''code'' in query parameter.

After that, application can get access token and refresh token from API token endpoint ( https://osdn.jp/api/v0/token ) with
followind arguments via '''POST request'''.

 * client_id: your application ID
 * client_secret: your application secret (key)
 * code: authentication code get by auth URL above.
 * grant_type: you need to set 'authorization_code'

=== Implicit grant

If your application cannot store client_secret sefety, you can use oauth2 implicit grant.

In implicit grant , you can get access token from auth URL ( https://osdn.jp/account/oauth2ui/authorize ) directly with following query parameters;

 * client_id: your application ID 
 * state: OAuth state string
 * response_type: set as 'token'
 * scope: (optional) space separated scopes. Currently avaiable scopres are  ''profile'', ''group'', ''group_write'', ''chamber'' and ''chamber_write''. Default is ''profile''.

In this case, you can get access token with URL fragment without refresh token.