Tutorials

1

Authenticate

curl --request POST \
     --url 'https://idaas-sandbox.hanchuess.com/portal/oauth/token?grant_type=client_credentials&client_id={CLIENT_ID}&client_secret={CLIENT_SECRET}' \
     --header 'Accept: application/json' \
     --header 'Accept-Language: en-US'
2
curl --request POST \
     --url https://idaas-sandbox.hanchuess.com/api/users/link \
     --header 'Accept-Language: en-US' \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer {CLIENT_ACCESS_TOKEN}' \
     --data '{
       "externalUserId": "{USER_ID_IN_YOUR_SYSTEM}"
     }'

After generating it, the partner should open the link in an in-app browser to avoid users leaving the app during the linking process, be careful that link will expired in 5 minute.

3

Token Issue

curl --request POST \
     --url 'https://idaas-sandbox.hanchuess.com/portal/oauth/token?grant_type=authorization_code&code={CODE}&redirect_uri={REDIRECT_URL}&client_id={CLIENT_ID}&client_secret={CLIENT_SECRET}' \
     --header 'Accept: application/json' \
     --header 'Accept-Language: en_US'
4

Get your power plant

curl --request POST \
     --url 'https://idaas-sandbox.hanchuess.com/api/v1/station/list' \
     --header 'Accept-Language: en-US' \
     --header 'Authorization: Bearer {USER_ACCESS_TOKEN}' \
     --header 'Accept-Language: en-US' \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --header 'X-Nonce: {RANDOM_SIX_CHARACTERS}' \
     --header 'X-Signature: {SIGNATURE_VALUE}' \
     --header 'X-Timestamp: 1747278514242' \
     --data '{
       "externalUserId": "fd5ab2f3-a83f-2479-ca4c-bfd30ba9d884"
     }'

See the Signature for more details.

5

Grant withdraw (Optional)

curl --request POST \
     --url 'https://idaas-sandbox.hanchuess.com/portal/oauth/revoke?token={USER_ACCESS_TOKEN}&token_type_hint=access_token' \
     --header 'Content-Type: application/json'

Last updated