# NiXT API

This API provides master-data, measurements and logs from projects, sites and devices. Project owner consent permission to the API-consumer to retrieve their data resource to prerequisite for the usage of this API.

  • Common Specification
    • Domain Name
    • Status Codes
  • Authentication
  • Site
    • Site List
    • Get Site Info by Site
  • Devices
    • Device List
    • Get Device Info by Device
    • Direct Command to Device
  • IoT Dictionary
    • Meter
    • Inverter
    • Smart Logger
    • Weather Station
    • Sensor
    • Equipment and Package
  • Get Data
    • The Raw Data
    • The Lasted Data
    • Tha Average Data 15 Minutes
    • Tha Average Data 1 hour
    • Tha Average Data daily
    • Tha Summary Data 15 Minutes
    • Tha Summary Data 1 hour
    • Thailand Public Holiday
  • Meter / Inverter / Battery Data
    • Hourly Energy
    • Daily Energy
    • Monthly Energy Monthly
    • Average Power 15 Mintues
    • Max Average Power 15 Mintues
    • Performance Ratio per site for Inverter
    • Predict Power for inverter
    • Demand Charge for meter
  • Weather Data
    • Air Quality Index - Daily
    • Weather - Daily
    • Weather - Monthly
    • Weather - Lasted feel like
    • Rainfall - Hourly
    • Rainfall - Daily

# Common Specification

Common specifications for Messaging API such as the domain name of endpoints, response when a request succeeds or fails and rate limit.

# Domain Name

TIP

{url} Domain name could be requested by IoT Team

# Status Codes

These HTTP status codes returned after an API call. We follow the HTTP Status Code Specification (opens new window)(opens new window) unless otherwise stated.

Status Code Description
0 OK Request successful
401 Unauthorized Valid channel access token is not specified
403 Forbidden No authorized to access the resource.
Confirm that your account or plan is authorized to access the resource
404 Not Found Unable to get profile information, please contact us
500 Server Error Error on the internal server
522 API key failed Invalid API key

# Response Code

The following JSON data is returned in the response body when an error occurs.

Response code message
0 OK Success
1101 Device not found
1102 Not support for this device type
1110 Call direct method failed
1120 Not support for this device type
4101 Invalid client or secret.
9105 Wrong Site ID or device ID

# Authentication

To authorize all requests from this point bellow. Use your user API Token, created on Dashboard as an Authorization header in the request.

acesstoken

# HTTP Request

POST {url}/auth/token

# Request Headers

Key Value
x-language en

# Request Body

Parameter Required Type Description
clientId YES String Assigns the client ID of the issued auth
secretKey YES String Assigns secret key to issued auth

Danger

You must replace clientId and secretKey with your personal API key.

# Response

When successfully redirect to the assigned redirect_uri or posts according to the form with the parameters below attached.

Parameter Type Description
appName String Your app name
expireIn Number Amount of time in seconds from issuing to expiration of the channel access token
accessToken String Channel access token
{
    "data": {
        "appName": "YOUR_APP",
        "expireIn": 1800,
        "accessToken": "YOUR_API_TOKEN_HERE"
    }
}

# Error Response

When there is a failure, redirects to the assigned reirect_uri with the parameters below.

Parameter Type Description
code Number Error code
message String Details of the error. Not returned in certain situations.
{
    "code": 4101,
    "message": "Invalid client or secret"
}

WARNING

YOUR_API_TOKEN_HERE will be specified on Authorization - Bearer in Headers when request data.