Omnivoltaic OTP API¶
Reference: API Documentation
Table of Contents¶
- Token Code Generation Overview
- Authentication
- Error Codes
- Global Variables
- Login
- Distributor APIs
- Asset Token Code
- Token Code History
Token Code Generation Overview¶
Omnivoltaic device firmware can change operation behaviour based on the commands it receives. Token code is a specific device control command that changes its allowed time to run, similar to the credits of coin-operated meters. When a valid token code is entered into a device, it will cause device internal credit count to increase by an amount coded in the token or set it to special states "free" or "reset".
Token code generation API is designed for 3rd party to generate these codes to control Omnivoltaic devices. A common scenario is for product distributors or PAYG SaaS service providers to create tokens that control the running credit of an Omnivoltaic device, based on the business rules of their applications. The device token code generator only deals with the actual token generation, agnostic of the value of token credit. The minimum granularity of credit for Omnivoltaic devices is a day or 24 hours.
Codes are generated using a unique device identifier, and a code is valid one time only (OTP). Furthermore, codes can only be generated for devices that have been assigned to the API client account. Authorization is needed through a registration and approval process. Once authorized, an accessToken will be provided. Only authorized users will be able to request and be granted access tokens. Access to different portions of this API is based on account type and granted access level.
Authentication¶
The accessToken can be obtained through a registration process. Check the Login section for the entire signup/sign-in process. API access authorization has different levels, for instance, "distributor" and "oves-admin". The authorization level determines which parts of the API can be accessed. Authorization depends on the value of accessToken passed in the header.
Error Codes¶
- 1xx: Informational — Transfer protocol-level information
- 2xx: Success — Request accepted successfully
- 3xx: Redirection — Client must take additional action
- 4xx: Client Error — Points to client-side issues
- 5xx: Server Error — Server takes responsibility
Global Variables¶
{{authorization}}— Value of accessToken from login API{{domain}}— Instance of domain (DEV vs PROD){{graphqldomain}}— GraphQL API domain
Login¶
All API users must obtain signup approval from Omnivoltaic via B2B portal. Once approved, login and password credentials will be sent to the email provided. Use the login and renewToken endpoints to obtain access token.
POST login¶
https://new-b2b-dev.omnivoltaic.com/
Headers: Content-Type: application/json
Body:
{
"username": "ds.sparkle018@gmail.com",
"password": "Sparkle1#"
}
POST renewToken¶
{{graphqldomain}}
Used to renew the accessToken (valid for 1 hour). Use full login credentials for renewal.
Distributor¶
APIs under this section require authentication token for the registered distributor account profile.
Asset Listing¶
GET assignedItemsList¶
https://api.omnivoltaic.com/oves/assignedItemsList/0/5
Returns a list of assigned items (up to 100). Response is based on user's authentication. Query parameters are optional. Distributors must request OVES_Admin for item assignment. Once assigned, distributor is notified by email.
Headers: Authorization: {{authorization}}, Content-Type: application/x-www-form-urlencoded
GET assignedItemsGet¶
https://api.omnivoltaic.com/oves/assignedItems/19
Get assigned item detail by passing ProductId in the URL parameter. ProductId is the device's productItemID from assignedItemsList.
Asset Token Code¶
- freeCode — Generates a permanent credit code (device runs free)
- resetCode — Generates a code to set the device to "0-day locked" state
POST freeCode¶
https://api.omnivoltaic.com/code/code/freecodeotp
Headers: Content-Type: application/json, Authorization: {{authorization}}
Body:
{
"productId": 5816
}
POST resetCode¶
https://api.omnivoltaic.com/code/code/resetcode
Body:
{
"productId": 163
}
POST daysCode¶
https://api.omnivoltaic.com/otp/daysCode
The "days" parameter must be between 1 and 1095.
Body:
{
"productId": 163,
"days": 5
}
Token Code History¶
GET codeHistoryList¶
https://api.omnivoltaic.com/oves/codeHistoryList/38/0/5
Path parameters: /:productID/:offset/:limit
GET codeHistoryMetadata¶
https://api.omnivoltaic.com/oves/codeHistory_Metadata