
2CMC489001M0201
50
G13
Revision: A
User Manual
JSON Communication
General
Conventions
The API is designed with the following assumptions and considerations
:
• At any time gateway supports only one version of API
• Query parameters in the form of "
?key=value
" are not allowed with any
of the supported http verbs
• Update requests are made with
Content-Type: application/
json
.
form-urlencoded
style is not allowed.
• Max payload size in case of update requests (POST, PUT, DELETE) is 512
bytes.
In case of firmware upload with
multipart/form-data
API user can
loop data in chunks of 512 bytes.
• Responses for GET requests are always streamed. And response may be of
varied length
.
• GET request will not have payload. URI itself should provide all required
information
• POST, PUT, DELETE requests will have payload as well as arguments in
URI as applicable.
• Requests applicable to a particular meter will always start with
/meters/
<serial>.
Higher level resource
/meters
returns list of all meters and their serial
numbers.
• Responses may vary depending on type of meter.
Example:
Phase angles are not supported in all types of meters.
Also there are some resources which are applicable in case of advanced
meters only.
Harmonics are supported in platinum series of meters only.
Error Handling
Error handling is designed around HTTP status codes.
Server would respond with the following status codes:
• 20x - success. Complete or partially success
• 40x - authentication, JSON parsing etc. where the gateway refused to
process the request
• 50x - gateway started processing the request, but failed while performing
the operation
I
n case of GET requests response may include valid data or status message.
In case of update (POST, POST, DELETE) requests, the response would always
be status message.
Format of status message is
{"status":"error","des":"URI not
found."}
.