![]() |
What is rinkak 3D Print Cloud API?This is an API that can utilize the rinkak provided digital manufacturing service as a cloud service. Because rinkak fully supports the difficult work of managing manufacturing, ordering, and distribution, anyone can easily incorporate 3D printing functionality into an app or a web service. |
Login to rinkak. Move to "Account settings" from the pull-down menu on the icon on the upper right of the screen.
Turn the "Register with rinkak Developer" check box on. Registration is complete when you click "Update". When you turn rinkak Developer on, [shop_secret] will appear in "Shop Settings". This is the string used for API requests.
When registration for rinkak developer is complete, an "App" category will be added to the pull-down menu on the icon on the upper right. You can make an app by moving to the "App" category and performing "Register a new app". The items required for the "App" category are as below.
For Redirect URI, please specify the URI of the site that will receive the OAuth2.0 authorization code. Both Icon and Name will be shown to the user. The Icon, Name, Description and Web Site URL are used as branding materials. You can obtain the client_id and client_secret when registration is complete. Use these to perform OAuth2.0 authentication.
Performing authorization as stipulated by the OAuth 2.0 Protocol is required in order to use each API from the client program. Through this process, what kind of API access the program will perform and what kind of information will be referred to or updated (this is called the scope) will be presented to the user.
Regarding user authentication and the scope that is presented, the client program can only obtain information (such as tokens) for accessing the API when the user has consented.
URL | https://www.rinkak.com/oauth2/auth |
---|---|
(Parameters) | |
client_id | The client_id value shown in app information |
redirect_uri | The redirect_uri value set in app information |
scope | cart product |
An access permission notification will open when the below URL is accessed directly. When there are multiple ranges to be specified in the scope parameter, enter multiple items separated by a space.
Specifically, access will be like the example below.
https://www.rinkak.com/oauth2/auth?client_id=[app's client_id]&redirect_uri=[app's redirect_uri]&scope=cart product
An authentication and authorization confirmation screen like the one below will be shown on the browser to the user.
When the user presses the "Allow Access" button, the authorization code is received as the code parameter of the redirect_uri.
[redirect_uri]?code=[Authorization Code]
In addition, if the user clicks the "Decline" button, they will be redirected to the [redirect_uri] that does not contain the code parameter.
In addition, if the user clicks the "Decline" button, they will be redirected to the [redirect_uri] that does not contain the code parameter. This authorization code is valid for 600 seconds (10 minutes). If 10 minutes have passed, the authorization code will be invalidated so it will be necessary to start over and obtain it again.
In order to access each of the APIs, a token is necessary. The token is obtained by accessing the URLs below using the HTTP POST method.
URL | https://www.rinkak.com/oauth2/token |
---|---|
(Parameters) | |
client_id | The client_id value shown in app information |
client_secret | The client_secret value shown in app information |
redirect_uri | The redirect_uri set in app information |
grant_type | authorization_code or refresh_token |
code | The authorization code obtained with user authentication and authorization |
curl -d client_id=[App's client_id] -d client_secret=[App's client_secret] -d redirect_uri=[App's redirect_uri] -d grant_type=authorization_code -d code=[Authorization Code] https://www.rinkak.com/oauth2/tokenIf a request is made correctly, JSON format data as in the below example can be obtained.
{"access_token": "[Access token string]", "tokeny_type": "Bearer", "expires_in": 3600, "refresh_token": "[Refresh token string]"}
When updating the period of validity of a token, specify refresh_token as the grant_type. The details of each JSON value are as below
Name | Type | Description |
---|---|---|
access_token | String | The token string for accessing each API |
token_type | String | The type of access token. The value "Bearer" will be returned. |
expires_in | Integer | The time (in seconds) until the token expires. |
refresh_token | String | The refresh token string used when updating an access token |
grant_type | String | authorization_code |
code | String | The authorization code obtained with user authentication and authorization |
A JSON will come back even when some form of error occurs. The error element is included in the JSON and the details are as below.
Error name | Meaning |
---|---|
invalid_request | A mistake in specifying the parameter |
unsupported_grant_type | Unsupported grant_type |
invalid_grant | Invalid Authorization Code |
invalid_token | An incorrect or expired token. |