免费试用

免费试用

原料药

认证方式

本节将帮助开发人员认证并开始使用Zenscale REST API进行API调用。


Zenscale OAuth 2.0身份验证

要开始使用Zenscale API,您需要使用以下步骤在您的Zenscale帐户中启用API密钥访问。

*您需要使用公司的主要用户登录才能完成以下步骤。

 Login to api.zenscale.in > Go To Company Profile > 原料药  Tab > Enable API Key Access.

Once that is in place, you'll have to allow one of your zenscale user for Developer Access using below steps:

 Login to api.zenscale.in > Go To Add User > Enable Developer Access.

Now you can access APIs using this Developer Account


For obtaining access/bearer tokens, we support Password Grant Client of RFC-6749's grant flows

Get Access Token

Once you have enable API Key Access you may request an {access_token} by issueing POST request to /oauth2/login endpoint
If the request is successful, you will receive an access_token and refresh_token in the JSON response from the server. Below is the example of Access Token / Login API with cURL.

curl --location --request POST '//api.goodluck82.com/resource/api/oauth2/login' \
--header 'Content-Type: application/json' \
--form 'company_code={company_code}' \
--form 'username={username}' \
--form 'password={password}'


Get Refresh Token

Our {access_tokens} expire in 15 minutes. When this happens you'll get 401 response.

now, you need to call below api to get new {access_token} for next 15 minutes. Remember, our {refresh_token} would be active for 30 minutes, that means after 15 minutes of {access_token}'s Expiration you can get new {access_token}.

curl --location --request POST '//api.goodluck82.com/resource/api/oauth2/refresh_token' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {access_token}' \
--form 'refresh_token={refresh_token}'
                


开始访问API

以下是用于访问所有Zenscale API的基本URL
  //api.goodluck82.com/resource/api/v1  
当您开始调用API时,请在api端点后面附加基本网址,然后传递标头变量

'Content-Type: application/json', 
'Authorization: Bearer {access_token}'

现在,您需要将参数作为请求的主体部分传递。

原料药 响应

每个Zenscale API的响应主体将包含以下三个索引
  {'type':'','message':'','data':[]} 
a)“类型”可能是成功/错误/警告。
b)'消息'此索引将包含消息相关响应。
b)'数据'该索引通常是数组,其中将包含数据对象列表。