0% found this document useful (0 votes)
47 views14 pages

TMR Rest API Documentation

TMR Rest API Documentation.docx

Uploaded by

thatjazz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views14 pages

TMR Rest API Documentation

TMR Rest API Documentation.docx

Uploaded by

thatjazz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

MOJEC REST API DOCUMENTATION

TMR-2012 Data Service


REST API Documentation
The TMR-2012 data service REST API enables third-party services or applications to access the TMR
metering data. The API returns data in JSON format.

1. Data Item Information


The data items in the REST APIs are identified by their data item IDs. The data item
information query shows the details of the data items, namely the item name, item no.
(identifier), OBIS code, attribute id, data type (optional), and decimal digits (optional).
Input Format:
/TMRDataService/itemInfo/item
or
/TMRDataService/itemInfo/item?itemNo=49
Parameters:
The optional itemNo parameter specifies the item number (identifier) to get the information
on. If not specified all the available data items will be returned.
Example Output:
{
"pageInfo":
{
"endRowNum":884,
"startRowNum":1,
"totalRowNum":884
},
"data":
[ {
"itemName": "Clock",
"itemNo": 1,
"obis": "0-0:1.0.0*255",
"attributeId": 2,
"decimalNumber": 0,
"dataType": "DateTime"
},
{
"itemName": "Meter No",
"itemNo": 25,
"obis": "1-0:0.0.0*255",
"attributeId": 2,
"decimalNumber": 0,
"dataType": "ASCII"
},
{
"itemName": "User No",

MOJEC CONFIDENTIAL DOCUMENT1


MOJEC REST API DOCUMENTATION

"itemNo": 26,
"obis": "1-0:0.0.1*255",
"attributeId": 2,
"decimalNumber": 0,
"dataType": "ASCII"
},
{
"itemName": "Total import active max demand",
"itemNo": 44,
"obis": "1-1:1.6.0*255",
"attributeId": 2,
"standardScaler": 0,
"standardUnit": "kW",
"decimalNumber": 4
},
{
"itemName": "Total Import Active Energy",
"itemNo": 49,
"obis": "1-1:1.8.0*255",
"attributeId": 2,
"standardScaler": 0,
"standardUnit": "kWh",
"decimalNumber": 4
},
…]
}

2. Device Information
Device information API provides the information for a certain meter or data concentrator,
such as the meter number, name, type, CT ratio, PT ratio, installation date etc.
Input format:
To get the information of one device:
/TMRDataService/deviceInfo/device?deviceNo=0101150001275
Or, to get the information of 500 devices:
/TMRDataService/deviceInfo/device?skip=0&take=500
Parameters:
The optional deviceNo parameter specifies the device identifier to return information on.
The optional skip and take parameters allows the pagination of device results. They specify
the start row number and maximum count of devices to return. For example, skip=0
&take=500 returns the first 500 devices. Note that both the default and the maximum
number of devices to return in one query is 500.
Output Example:
{
"pageInfo":
{
"endRowNum":10,

MOJEC CONFIDENTIAL DOCUMENT2


MOJEC REST API DOCUMENTATION

"startRowNum":1,
"totalRowNum":14
},
"data":
[{
"meterNo":"0060015051001",
"meterName":"Meter1500_0060015051001",
"meterType":"DLMS_METER",
"meterCt":"1.0/1.0",
"meterPt":"1.0/1.0",
"installationDate":"2015-07-17 17:01:53"
},
{
"meterNo":"14010028",
"meterName":"timingtasktest",
"meterType":"DLMS_METER",
"meterCt":"1.0/1.0",
"meterPt":"1.0/1.0",
"installationDate":"2015-08-11 15:35:52"
},

]
}

3. Billing Data
The billing data query returns the monthly billing data for the selected device on the
selected month.
Input Format:
/TMRDataService/billingData?deviceNo=873010080143&dataRecordMonth=2015-10
Parameters:
The required deviceNo parameter specifies the device number to get the billing data on.
The required dataRecordMonth parameter specifies which month to get the data for.
Output Example:
{
"data":
[{
"meterNo":"3299000000",
"meterName":"M7330CT123",
"dataRecordMonth":"2015-10",
"49":"3058",
"91":"0",
"137":"0",

MOJEC CONFIDENTIAL DOCUMENT3


MOJEC REST API DOCUMENTATION

"50":"0",
"51":"0",
"52":"0",
"92":"0",
"93":"0",
"94":"0",
"45":"0",
"46":"0",
"47":"0",
"87":"0",
"88":"0",
"89":"0",
"72":"0"
}]
}

4. Load Profile Data


The load profile data provides the load profile data for the specified device in the specified
date time range.
Input format:
/TMRDataService/loadProfileData?deviceNo=0101150001275&itemNo=49&startTime=2015
-01-01 00:00:00&endTime=2015-07-01 00:00:00&loadProfileNo=1&skip=0&take=500
Parameters:
The optional deviceNo parameter specifies the device number to get the load profile data
on.
The optional itemNo parameter specifies which items to return. If not specified, all the
available data items will be returned. To specify more than one items, join the numbers with
“,”, or “-“. For example, “itemNo=42,50,51” means to get data with item number 42, 50, and
51. “itemNo=42,49-56” means to get items 42 and item 49 to 56.
The optional startTime and endTime parameter specifies the start and end time of the
results. If not specified, all the data available from the very beginning will be returned.
The optional loadProfileNo parameter specifies the load profile number of the results, 0
means load profile 0 and 1 means load profile 1. If not specified, the default load profile
number is 1(load profile 1).

MOJEC CONFIDENTIAL DOCUMENT4


MOJEC REST API DOCUMENTATION

The optional skip and take parameters allows the pagination of the results. They specify the
start row number and maximum count of records to return. The default maximum number
of records is 500.
Example Output:
{
"pageInfo":
{
"endRowNum":500,
"startRowNum":1,
"totalRowNum":52900},
"data":
[
{
"49": "171378",
"meterNo": "060014010040",
"meterName": "Meter0001",
"captureInterval":15,
"captureTime": "2014-06-30 23:45:00"
},
{
"49": "171368",
"meterNo": "060014010040",
"meterName": "Meter0001",
"captureInterval":15,
"captureTime": "2014-06-30 23:30:00"
},
{
"49": "171332",
"meterNo": "060014010040",
"meterName": "Meter0001",
"captureInterval":15,
"captureTime": "2014-06-30 23:15:00"
},
{
"49": "171302",
"meterNo": "060014010040",

MOJEC CONFIDENTIAL DOCUMENT5


MOJEC REST API DOCUMENTATION

"meterName": "Meter0001",
"captureInterval":15,
"captureTime": "2014-06-30 23:00:00"
},
{
"49": "171289",
"meterNo": "060014010040",
"meterName": "Meter0001",
"captureInterval":15,
"captureTime": "2014-06-30 22:45:00"
},
{
"49": "171265",
"meterNo": "060014010040",
"meterName": "Meter0001",
"captureInterval":15,
"captureTime": "2014-06-30 22:30:00"
},
{
"49": "171253",
"meterNo": "060014010040",
"meterName": "Meter0001",
"captureInterval":15,
"captureTime": "2014-06-30 22:15:00"
},
{
"49": "171224",
"meterNo": "060014010040",
"meterName": "Meter0001",
"captureInterval":15,
"captureTime": "2014-06-30 22:00:00"
}]
}

MOJEC CONFIDENTIAL DOCUMENT6


MOJEC REST API DOCUMENTATION

5. Event Information
The event information query shows the details of the events, namely the event name, event
code.
Input format:
/TMRDataService/eventInfo/event
or
/TMRDataService/eventInfo/event?eventCode=1
Parameters:
The optional eventCode parameter specifies the event code to get the information on. If not
specified all the available events will be returned.
Example Output:
{
"pageInfo":
{
"endRowNum":110,
"startRowNum":1,
"totalRowNum":110
},
"data":
[ {
"eventCode": 63,
"eventName": "Over Voltage"
},
{
"eventCode": 59,
"eventName": "Over Current"
},
{
"eventCode": 102,
"eventName": "Voltage Loss"
},
…]
}

6. Event Data
The event record data provides the event record data for the specified device in the
specified date time range. (The result statusFlag: 1 means event start and 2 means event
end).
Input format:
/TMRDataService/eventData?deviceNo=0101150001275&eventCode=1&startTime=2015-01
-01 00:00:00&endTime=2015-07-01 00:00:00&skip=0&take=500
Parameters:

MOJEC CONFIDENTIAL DOCUMENT7


MOJEC REST API DOCUMENTATION

The optional deviceNo parameter specifies the device number to get the event data on.
The optional eventCode parameter specifies which events to return. If not specified, all the
available data events will be returned.
The optional startTime and endTime parameter specifies the start and end time of the
results. If not specified, all the data available from the very beginning will be returned.
The optional skip and take parameters allows the pagination of the results. They specify the
start row number and maximum count of records to return. The default maximum number
of records is 500.
Example Output:
{
"pageInfo":
{
"endRowNum":500,
"startRowNum":1,
"totalRowNum":1230},
"data":
[
{
"eventCode": "1",
"meterNo": "060014010040",
"meterName": "Meter0001",
"statusFlag": 1
"captureTime": "2014-06-30 23:45:00"
},
{
"eventCode": "2",
"meterNo": "060014010040",
"meterName": "Meter0001",
"statusFlag":2,
"captureTime": "2014-06-30 23:30:00"
},
{
"eventCode": "3",
"meterNo": "060014010040",
"meterName": "Meter0001",
"statusFlag":1,

MOJEC CONFIDENTIAL DOCUMENT8


MOJEC REST API DOCUMENTATION

"captureTime": "2014-06-30 23:15:00"


},

]
}

7. Load Control
7.1. Disconnect/Reconnect
The API for load control to disconnect/reconnect the contactor of the meter. Because the
API requires interaction with the meter, and depending on the meter’s communication
operation mode, this could take anywhere from a few seconds to hours.
Therefore the API is asynchronous. The caller of the API invoke the command API, and gets
an UUID in the result. Then the caller of the API may query the command result via the
UUID.

Command API:
Input format:
/TMRDataService/load_control?deviceNo=060014010028&command=disconnect&schedule
=2016-12-01 00:00:00
Parameters:
deviceNo: required. Serial number of the target device.
command: required. Either disconnect or reconnect, case-ignored.
schedule: optional. Specifies the disconnect or reconnect schedule. Format is yyyy-MM-dd hh:mm:ss. If the
option is not specified, the command is executed immediately.

Output example:
{
“meterNo”: “060014010028”,
“meterName”: “SAMPLE_METER_0028”,
“uuid”: “89C3B4DE-05E5-4CFA-9916-B2985F41B08E”
}

Result API:
Input format:
/TMRDataService/load_control/op_result?uuid=89C3B4DE-05E5-4CFA-9916-B2985F41B08E

MOJEC CONFIDENTIAL DOCUMENT9


MOJEC REST API DOCUMENTATION

Output example:
{
“meterNo”: “060014010028”,
“meterName”: “SAMPLE_METER_0028”,
“statusCode”: 1000
}

7.2. Relay State Update


The API for updating relay status. Because the API requires interaction with the meter, and
depending on the meter’s communication operation mode, this could take anywhere from a
few seconds to hours.
Therefore the API is asynchronous. The caller of the API invoke the command API, and gets
an UUID in the result. Then the caller of the API may query the command result via the
UUID.

Command API:
Input format:
/TMRDataService/relay_state?deviceNo=060014010028
Parameters:
deviceNo: required. Number of target device.

Output example:
{
“meterNo”: “060014010028”,
“meterName”: “SAMPLE_METER_0028”,
“uuid”: “63557BEC-C1C7-451A-A59A-3C844C8B37C9”
}

Result API:
Input format:
/TMRDataService/relay_state/op_result?uuid=63557BEC-C1C7-451A-A59A-3C844C8B37C9
Output example:
{
“meterNo”: “060014010028”,
“meterName”: “SAMPLE_METER_0028”,

MOJEC CONFIDENTIAL DOCUMENT10


MOJEC REST API DOCUMENTATION

“statusCode”: 1000,
“relayState”: “Disconnected”
}

Results:
relayState: Either Disconnected, Connected or Ready_for_reconnection.

7.3. Relay State Query from DB

You can use this function from tmr to configure the task to periodically
collect the current state of the meter’s relay.
For example, the below UI configures to read the relay status every 3 hours, and save that status to the
database.

Then you can use this API to query the relay status from the database. The API is synchronous and will not
need to wait for a communication result from the meter.

Command API:
/TMRDataService/relay_state_cached/query?skip=0&take=500
Example Output:
{
"pageInfo":
{
"endRowNum":500,
"startRowNum":1,
"totalRowNum":1230},
"data":
[
{
"meterNo": "343016056816",
"relayState": “Disconnected”,
"captureTime": "2014-06-30 23:45:00"

MOJEC CONFIDENTIAL DOCUMENT11


MOJEC REST API DOCUMENTATION

},

]
}

Or command like this:

Command API :
/TMRDataService/relay_state_cached?deviceNo=343016056816
Example Output:
{
"meterNo": "343016056816",
"relayState": “Disconnected”,
"captureTime": "2014-06-30 23:45:00"
}

8. Send STS Token to Meter


The API to send STS tokens to the meters. Because the API requires interaction with the
meter, and depending on the meter’s communication operation mode, this could take
anywhere from a few seconds to hours.
Therefore the API is asynchronous. The caller of the API invoke the command API, and gets
an UUID in the result. Then the caller of the API may query the command result via the
UUID.

Command API:
Input format:
/TMRDataService/sendToken?deviceNo=0600140100281&token=41699982783217220077
Parameters:
deviceNo: Required. Number of target device.
token: Required. The token to send to meter.

Result API:

MOJEC CONFIDENTIAL DOCUMENT12


MOJEC REST API DOCUMENTATION

Example Output:
{
"meterNo":"0600140100281",
"meterName":"testem",
"uuid":”1129225f-8566-4b79-b990-0c5a554cacc1”
}

Query Token Input format:


/TMRDataService/queryToken?uuid=1129225f-8566-4b79-b990-0c5a554cacc1
Example Output:
{
"meterNo":"0600140100281",
“errorcode”:1000
}

Error Codes
Error Codes
Code Description
1000 Success
1001 Parameter Error
1002 Parameter Missing Error
1003 No Result Error
1004 Database Error
1005 In Process
1006 Exceed Quota
2002 TOKEN rejected
2003 TOKEN expired
2004 TOKEN used
2005 Manufacture code error
2006 Key expired error
2007 DDTK error
2008 Charge amount overflow
2009 Key type Error
2010 Incorrect TOKEN data format
2011 Key range error
2012 Function not supported
2013 The first section key is accepted and OK
2014 The second section key is accepted and OK
2015 Lockout After 10 continuous rejections of token inputs, P2000 will lock out for one day (24
hours). During this period, any token entry will be rejected. After one day customers can input
tokens again.

MOJEC CONFIDENTIAL DOCUMENT13


MOJEC REST API DOCUMENTATION

9. Generate STS Vending Token


The API to generate STS vending tokens. The API can be invoked by trusted third-party
systems or applications to generate the STS vending tokens. HTTPS and mutual certificate is
used to authenticate and protect the data.
Input format:
/TMRDataService/getStsVendingToken?deviceNo=0600140100281&customerAccount=1234
56789&sgc=600415&ti=2&rechargeAmount=100
Parameters:
deviceNo: Required. The serial number of target device.

customerAccount: Optional. The customer account number.


sgc: Optional. The supply group code. Will use default SGC if not specified.
ti: Optional. The tariff index. Will use default tariff index if not specified.
rechargeAmount: Required. The recharge amount.

Example Output:
{
"meterNo":"0600140100281",
“token”:41699982783217220077
“errorcode”:1000
}

Error Codes
Error Codes
Code Description
1000 Success
1001 Parameter Error
1002 Parameter Missing Error
1003 No Result Error
1004 Database Error
1006 Exceed Quota

MOJEC CONFIDENTIAL DOCUMENT14

You might also like