API Documentation

Last Updated : 6 July, 2020

Introduction

This document provides information about Restful API Endpoints, expected request template and possible response for Crestflow Energy Vend API.

Registration

To initiate user registration, see expected JSON request below.

API Endpoint
POST : https://vendapp.crestflowenergy.com/api/register
JSON Request
{
    "name": 'Jane Doe',
    "email": 'janedoe@crestflowenergy.com',
    "password": '********',
    "estate": 1,
    "flat_number": "55A",
    "meter_type": 1,
    "meter_phase_type": 1,
    "meter_number": "01234567890"
}

If request is successful, you will receive the below JSON response with a 201 created status code.

JSON Response
{
    "message": "Registration Successful"
}

The below response is received if there is an error from meter API (API that connects to the meters). Most common cause is due to invalid account and this is as a result of using wrong credentials to query meter data or vend or to carry out any meter operation(Invalid Estate/Meter pair).

A typical scenario is when you query with wrong company name/Estate or meter number. This comes along with a 422 status code.

JSON Response
{
    "message": "API error - invalid account"
}

On very rare cases when we are unable to establish connection to the meter API servers, a 503 status code is returned with the response below.

JSON Response
{
    "message": "Something seems to be wrong"
}

A 422 status code is also returned if one or more of the values provided in your JSON request is invalid e.g. Providing an email address or meter number that has already been used to register, meter number provided is not numeric, meter_type,meter_phase_type or estate value provided is not an integer(During registration, the IDs of these values is what is required not their labels) - password provided is less than 8 characters

JSON Response
{
    "message":"The given data was invalid.",
    "errors":{
        "email":["The email has already been taken."]
    }
}

Options

This Endpoint returns a 200 OK status code with data of all estates, meter types and meter phase types available.

API Endpoint
GET : https://vendapp.crestflowenergy.com/api/options
JSON Response
{     "estates":[
        {
            "id":1,
            "name":"Estate1",
            "paystack_account_code":"ACCT_**************",
            "transaction_charge":200,
            "created_at":"2019-10-13 10:18:46",
            "updated_at":"2020-04-30 05:04:13"
        },
        {
            "id":2,
            "name":"Estate2",
            "paystack_account_code":"ACCT_***************",
            "transaction_charge":200,
            "created_at":"2019-10-13 17:06:18",
            "updated_at":"2020-04-30 05:03:56"
        },
    ],
    "meter_types":[
        {
            "id":1,
            "label":"single source",
            "created_at":"2019-10-13 10:18:46",
            "updated_at":"2019-10-13 10:18:46"
        },
        {
            "id":2,
            "label":"dual source",
            "created_at":"2019-10-13 10:18:46",
            "updated_at":"2019-10-13 10:18:46"
        }
    ],
    "meter_phase_types":[
        {
            "id":1,
            "label":"single phase",
            "created_at":"2019-10-13 10:18:46",
            "updated_at":"2019-10-13 10:18:46"
        },
        {
            "id":2,
            "label":"3 phase",
            "created_at":"2019-10-13 10:18:46",
            "updated_at":"2019-10-13 10:18:46"
        }
    ]
}

Login

The login API endpoint returns a 200 OK status code if the username and password provided is correct.

API Endpoint
POST : https://vendapp.crestflowenergy.com/api/login
JSON Request
{
    "email":"test@crestflowenergy.com",
    "password":"********"
}

If login credentials provided is correct, this API endpoint returns an API key with a 200 OK status code.

JSON Response
{
    "api_key":"TeStSAMplEHnr2SvlC9jMHrWe8de7tqWoqnKxtDuEeQz6wwAm6qWusRFLR1u2U7SlZ99PHUIF1XhdcxEJRrt6DXtXg0n2tzo5Hoa09LyKwsTb2mAH8PL5RZ"
}

If login credentials provided is incorrect, this API endpoint returns the response below with a 401 status code.

JSON Response
{
    "message":"Username and\/or password is invalid"
}

Authentication

All other actions that require authentication requests for the API key and checks to see if it is for a valid user. However, for scenarios where you just need to validate the API key before performing an action on your system e.g when a user already logged in on a device re opens your app then this API endpoint comes in handy.

API Endpoint
GET : https://vendapp.crestflowenergy.com/api/validate?api_key=[API key]

This Endpoint returns the below response with a 200 OK status code if the API key is valid.

JSON Response
{
    "message":"API key supplied is valid"
}

If an invalid API key is provided, this API endpoint returns a 401 status code with the response below.

{
    "message":"API Key supplied is invalid or has expired"
}

User

This API Endpoint is used to query data of a logged on user.

API Endpoint
GET : https://vendapp.crestflowenergy.com/api/user?api_key=[API KEY]

This Endpoint returns the below sample response with a 200 OK status code if the API key is valid.

JSON Response
{
    "data":{
        "id":1,
        "name":"Jane Doe",
        "email":"janedoe@crestflowenergy.com",
        "email_verified_at":null,
        "estate_id":1,
        "flat_number":"001",
        "created_at":"2019-10-13 10:18:46",
        "updated_at":"2020-06-24 10:30:52",
        "meter":{
            "id":1,
            "user_id":1,
            "meter_type_id":1,
            "meter_phase_type_id":1,
            "number":"47000000000",
            "created_at":"2019-10-13 10:18:46",
            "updated_at":"2019-10-13 10:18:46"
        },
        "meter_type":"single source",
        "meter_phase_type":"single phase",
        "estate":{
            "id":1,
            "name":"Estate1",
            "paystack_account_code":"ACCT_***************",
            "transaction_charge":200,
            "created_at":"2020-04-18 08:24:19",
            "updated_at":"2020-06-05 12:29:02"
        }
    }
}

If an invalid API key is provided, this API endpoint returns a 401 status code with the response below.

{
    "message":"API Key supplied is invalid or has expired"
}

Modify User

A logged on user can only modify full name details. This API endpoint enables this action.

You must include X-API-KEY with value being the API key of user in the request header.

Request Header
X-API-KEY:[API key]
API Endpoint
POST : https://vendapp.crestflowenergy.com/api/modify-user
JSON Request
{
    "name":"Jane Doe"
}

This endpoint returns the below response with a 200 OK status code if the API key provided is valid.

JSON Response
{
    "message":"Updated successfully"
}

If an invalid API key is provided, this API endpoint returns a 401 status code with the response below.

{
    "message":"API Key supplied is invalid or has expired"
}

Change Password

This API Endpoint is used to request change of password of a logged on user.

Request Header
X-API-KEY:[API key]
API Endpoint
POST : https://vendapp.crestflowenergy.com/api/change-password
JSON Request
{
    "currentpassword":"********",
    "newpassword":"********"
}

This Endpoint returns the below response with a 200 OK status code if the API key is valid and the values provided are valid.

JSON Response
{
    "message":"Password has been reset successfully"
}

If the current/old password value provided is incorrect, a 422 status code with the response below is returned.

{
    "message":"Incorrect current password"
}

When the value for the new password does not meet password requirements, a 422 status code with the response below is returned.

{
    "message":"The given data was invalid.",
    "errors":{
        "newpassword":["The newpassword must be at least 8 characters."]
    }
}

If an invalid API key is provided, this API endpoint returns a 401 status code with the response below.

{
    "message":"API Key supplied is invalid or has expired"
}

Token Receipts

The purpose of this API Endpoint is to provide token receipts record of a logged on user.

API Endpoint
GET : https://vendapp.crestflowenergy.com/api/tokenreceipts?api_key=[API key]&page=[page number]

This Endpoint returns the below sample response with a 200 OK status code if the API key is valid.

The page number in the request is optional, if this value is not provided - the Endpoint returns the first page of records. Response is paginated to 15 records.

JSON Response
{
    "data":[
        {
            "id":1,
            "meter_id":1,
            "meter_payment_transaction_id":1,
            "total_paid":100,
            "total_unit":100,
            "token":"0000 0000 0000 0000 0000",
            "meter_number":"40000000000",
            "gen_datetime":"2020\/6\/18 15:51:54",
            "price":0,
            "vat":0,
            "tid_datetime":"2020\/6\/18 15:52:54",
            "currency":"NGN",
            "unit":"m\u00b3",
            "task_no":"9bawda27-q6ef-41v3-96c2-0du5c0fcdbf5",
            "created_at":"2020-06-18 14:51:53",
            "updated_at":"2020-06-18 14:51:53",
            "meter_payment_transaction":{
                "id":1,
                "meter_id":1,
                "amount":300,
                "reference":"T000000000000000",
                "status":"success",
                "created_at":"2020-06-18 14:51:53",
                "updated_at":"2020-06-18 14:51:53"
            }
        },
        {
            "id":2,
            "meter_id":1,
            "meter_payment_transaction_id":null,
            "total_paid":200,"total_unit":200,
            "token":"1010 0011 0100 1000 0001",
            "meter_number":"40000000000",
            "gen_datetime":"2020\/6\/17 18:27:57",
            "price":0,
            "vat":0,
            "tid_datetime":"2020\/6\/17 18:28:57",
            "currency":"NGN",
            "unit":"m\u00b3",
            "task_no":"17w7b462-d8u1-424c-aw50-q96i95072569",
            "created_at":"2020-06-17 17:27:56",
            "updated_at":"2020-06-17 17:27:56",
            "meter_payment_transaction":null
        }
    ],
    "links":{
        "first":"https:\/\/vendapp.crestflowenergy.com\/api\/tokenreceipts?page=1",
        "last":"https:\/\/vendapp.crestflowenergy.com\/api\/tokenreceipts?page=2",
        "prev":null,
        "next":"https:\/\/vendapp.crestflowenergy.com\/api\/tokenreceipts?page=2"
    },
    "meta":{
        "current_page":1,
        "from":1,
        "last_page":2,
        "path":"https:\/\/vendapp.crestflowenergy.com\/api\/tokenreceipts",
        "per_page":15,
        "to":15,
        "total":19
    }
}

If an invalid API key is provided, this API endpoint returns a 401 status code with the response below.

{
    "message":"API Key supplied is invalid or has expired"
}

Meter Transactions

The purpose of this API Endpoint is to provide meter transaction records of a logged on user.

API Endpoint
GET : https://vendapp.crestflowenergy.com/api/metertransactions?api_key=[API key]&page=[page number]

This Endpoint returns the below sample response with a 200 OK status code if the API key is valid.

The page number in the request is optional, if this value is not provided - the Endpoint returns the first page of records. Response is paginated to 15 records.

JSON Response
{
    "data":[
        {
            "id":1,
            "meter_id":1,
            "amount":300,
            "reference":"T000000000000000",
            "status":"success",
            "created_at":"2020-06-18 14:51:53",
            "updated_at":"2020-06-18 14:51:53",
            "meter":{
                "id":1,
                "user_id":1,
                "meter_type_id":1,
                "meter_phase_type_id":1,
                "number":"47000000000",
                "created_at":"2019-10-13 10:18:46",
                "updated_at":"2019-10-13 10:18:46",
                "user":{
                    "id":1,
                    "name":"Jane Doe",
                    "email":"test@crestflowenergy.com",
                    "email_verified_at":null,
                    "estate_id":1,
                    "flat_number":"001",
                    "created_at":"2019-10-13 10:18:46",
                    "updated_at":"2020-07-03 10:51:08",
                    "meter":{
                        "id":1,
                        "user_id":1,
                        "meter_type_id":1,
                        "meter_phase_type_id":1,
                        "number":"47000000000",
                        "created_at":"2019-10-13 10:18:46",
                        "updated_at":"2019-10-13 10:18:46"
                    },
                    "meter_type":"single source",
                    "meter_phase_type":"single phase",
                    "estate":{
                        "id":1,
                        "name":"Estate1",
                        "paystack_account_code":"ACCT_***************",
                        "transaction_charge":200,
                        "created_at":"2020-04-18 08:24:19",
                        "updated_at":"2020-06-05 12:29:02"
                    }
                },
                "meter_type":{
                    "id":1,
                    "label":"single source",
                    "created_at":"2019-10-13 10:18:46",
                    "updated_at":"2019-10-13 10:18:46"
                },
                "meter_phase_type":{
                    "id":1,
                    "label":"single phase",
                    "created_at":"2019-10-13 10:18:46",
                    "updated_at":"2019-10-13 10:18:46"
                },
                "meter_payment_transactions":[
                    {
                        "id":1,
                        "meter_id":1,
                        "amount":49999,
                        "reference":"T000000000000000",
                        "status":"success",
                        "created_at":"2019-10-23 19:55:13",
                        "updated_at":"2019-10-23 19:55:13"
                    },
                    {
                        "id":2,
                        "meter_id":1,
                        "amount":5000,
                        "reference":"T000000000000000",
                        "status":"success",
                        "created_at":"2019-12-05 09:18:57",
                        "updated_at":"2019-12-05 09:18:57"
                    }
                ],
                "token_receipts":[
                    {
                        "id":1,
                        "meter_id":1,
                        "meter_payment_transaction_id":1,
                        "total_paid":49999,
                        "total_unit":49999,
                        "token":"0000 0000 0000 0000 0000",
                        "meter_number":"40000000000",
                        "gen_datetime":"2019\/10\/23 20:55:13",
                        "price":35,
                        "vat":0,
                        "tid_datetime":"2019\/10\/23 20:56:13",
                        "currency":"NGN",
                        "unit":"m\u00b3",
                        "task_no":"w3c780u9-ge2e-40rc-8c98-fcu3uc75ee17",
                        "created_at":"2019-10-23 19:55:13",
                        "updated_at":"2019-10-23 19:55:13"
                    },
                    {
                        "id":2,
                        "meter_id":1,
                        "meter_payment_transaction_id":2,
                        "total_paid":5000,
                        "total_unit":5000,
                        "token":"0000 0001 0000 0000 0100",
                        "meter_number":"40000000000",
                        "gen_datetime":"2019\/12\/5 10:18:58",
                        "price":35,
                        "vat":0,
                        "tid_datetime":"2019\/12\/5 10:19:58",
                        "currency":"NGN",
                        "unit":"m\u00b3",
                        "task_no":"af6a0qf0-gdc4-48a6-a2u4-z483h45372bd",
                        "created_at":"2019-12-05 09:18:58",
                        "updated_at":"2019-12-05 09:18:58"
                    }
                ],
                "remote_reading_data":{
                    "id":1,
                    "meter_id":1,
                    "Cumulative_kWh_consumption":"503.67 kWh",
                    "Power_consumption_of_last_month":"492.66 kWh",
                    "Power_consumption_of_last_2nd_month":"478.8 kWh",
                    "Power_consumption_of_last_3rd_month":"478.09 kWh",
                    "Power_consumption_of_last_4th_month":"478.08 kWh",
                    "Power_consumption_of_last_5th_month":"478.02 kWh",
                    "Power_consumption_of_last_6th_month":"477.82 kWh",
                    "Power_consumption_of_last_7th_month":"477.57 kWh",
                    "Power_consumption_of_last_8th_month":"477.29 kWh",
                    "Power_consumption_of_last_9th_month":"477.24 kWh",
                    "Power_consumption_of_last_10th_month":"477.19 kWh",
                    "Power_consumption_of_last_11th_month":"477.19 kWh",
                    "Power_consumption_of_last_12th_month":"476.23 kWh",
                    "The_number_of_cover_meter_open":"5",
                    "The_last_cover_open_time":"19-07-19 13:33",
                    "The_last_2nd_cover_open_time":"19-07-17 08:43",
                    "The_last_3rd_cover_open_time":"19-07-15 15:31",
                    "The_last_4th_cover_open_time":"19-06-21 10:42",
                    "The_last_5th_cover_open_time":"19-06-21 10:42",
                    "The_last_6th_cover_open_time":"00-00-00 00:00",
                    "The_last_7th_cover_open_time":"00-00-00 00:00",
                    "The_last_8th_cover_open_time":"00-00-00 00:00",
                    "The_last_9th_cover_open_time":"00-00-00 00:00",
                    "The_last_10th_cover_open_time":"00-00-00 00:00",
                    "The_number_of_power_down":"254",
                    "The_last_power_down_time":"19-10-31 14:11",
                    "The_last_2nd_power_down_time":"19-10-31 10:52",
                    "The_last_3rd_power_down_time":"19-10-31 10:37",
                    "The_last_4th_power_down_time":"19-10-31 06:08",
                    "The_last_5th_power_down_time":"19-10-30 16:27",
                    "The_last_6th_power_down_time":"19-10-30 16:25",
                    "The_last_7th_power_down_time":"19-10-30 12:19",
                    "The_last_8th_power_down_time":"19-10-30 12:12",
                    "The_last_9th_power_down_time":"19-10-30 12:04",
                    "The_last_10th_power_down_time":"19-10-30 11:57",
                    "Voltage":"231.1129 V",
                    "Current":"1.33 A",
                    "Power":"0.0294 kW",
                    "Date":"19-10-31 04",
                    "Time":"18:18:22",
                    "The_number_of_credit":"74",
                    "Current_Credit_Register":"18725.9 kWh,ON",
                    "The_last_credit_amount":"20002.4 kWh",
                    "The_last_2nd_credit_amount":"500 kWh",
                    "The_last_3rd_credit_amount":"500 kWh",
                    "The_last_4th_credit_amount":"4200.4 kWh",
                    "The_last_5th_credit_amount":"19902.4 kWh",
                    "The_last_6th_credit_amount":"4975.4 kWh",
                    "The_last_7th_credit_amount":"79602.4 kWh",
                    "The_last_8th_credit_amount":"5979.4 kWh",
                    "The_last_9th_credit_amount":"5970.4 kWh",
                    "The_last_10th_credit_amount":"5473.4 kWh",
                    "The_last_credit_token":"0000 0000 0000 0000 0000",
                    "The_last_2nd_credit_token":"0000 0000 0000 0000 0000",
                    "The_last_3rd_credit_token":"0000 0000 0000 0000 0000",
                    "The_last_4th_credit_token":"0000 0000 0000 0000 0000",
                    "The_last_5th_credit_token":"0000 0000 0000 0000 0000",
                    "The_last_6th_credit_token":"0000 0000 0000 0000 0000",
                    "The_last_7th_credit_token":"0000 0000 0000 0000 0000",
                    "The_last_8th_credit_token":"0000 0000 0000 0000 0000",
                    "The_last_9th_credit_token":"0000 0000 0000 0000 0000",
                    "The_last_10th_credit_token":"0000 0000 0000 0000 0000",
                    "The_last_management_token":"0000 0000 0000 0000 0000",
                    "The_last_2nd_management_token":"0000 0000 0000 0000 0000",
                    "The_last_3rd_management_token":"0000 0000 0000 0000 0000",
                    "The_last_4th_management_token":"0000 0000 0000 0000 0000",
                    "The_last_5th_management_token":"0000 0000 0000 0000 0000",
                    "The_last_6th_management_token":"0000 0000 0000 0000 0000",
                    "The_last_7th_management_token":"0000 0000 0000 0000 0000",
                    "The_last_8th_management_token":"0000 0000 0000 0000 0000",
                    "The_last_9th_management_token":"0000 0000 0000 0000 0000",
                    "The_last_10th_management_token":"0000 0000 0000 0000 0000",
                    "Protocol_version_number":null,
                    "Dual_source_rate":"35,35",
                    "Clear_tampered":null,
                    "Clear_credit":null,
                    "created_at":"2019-10-23 02:15:02",
                    "updated_at":"2020-07-03 16:01:05"
                }
            },
            "token_receipt":{
                "id":1,
                "meter_id":1,
                "meter_payment_transaction_id":1,
                "total_paid":100,
                "total_unit":100,
                "token":"0000 0000 0000 0000 0000",
                "meter_number":"40000000000",
                "gen_datetime":"2020\/6\/18 15:51:54",
                "price":0,
                "vat":0,
                "tid_datetime":"2020\/6\/18 15:52:54",
                "currency":"NGN",
                "unit":"m\u00b3",
                "task_no":"9d23da27-26rf-42c3-98c2-0da9c9ecdbf5",
                "created_at":"2020-06-18 14:51:53",
                "updated_at":"2020-06-18 14:51:53"
            }
        },
        {...}
    ],
    "links":{
        "first":"https:\/\/vendapp.crestflowenergy.com\/api\/metertransactions?page=1",
        "last":"https:\/\/vendapp.crestflowenergy.com\/api\/metertransactions?page=2",
        "prev":null,
        "next":"https:\/\/vendapp.crestflowenergy.com\/api\/metertransactions?page=2"
    },
    "meta":{
        "current_page":1,
        "from":1,
        "last_page":2,
        "path":"https:\/\/vendapp.crestflowenergy.com\/api\/metertransactions",
        "per_page":15,
        "to":15,
        "total":19
    }
}

If an invalid API key is provided, this API endpoint returns a 401 status code with the response below

{
    "message":"API Key supplied is invalid or has expired"
}

Remote Reading Data

This API Endpoint returns last read remote reading data e.g Voltage, Cummulative kWh consumption etc.

API Endpoint
GET : https://vendapp.crestflowenergy.com/api/remotereading?api_key=[API key]

This Endpoint returns the below sample response with a 200 OK status code if the API key is valid

JSON Response
{
    "data":{
        "id":1,
        "meter_id":1,
        "Cumulative_kWh_consumption":"503.44 kWh",
        "Power_consumption_of_last_month":"492.66 kWh",
        "Power_consumption_of_last_2nd_month":"478.8 kWh",
        "Power_consumption_of_last_3rd_month":"478.09 kWh",
        "Power_consumption_of_last_4th_month":"478.08 kWh",
        "Power_consumption_of_last_5th_month":"478.02 kWh",
        "Power_consumption_of_last_6th_month":"477.82 kWh",
        "Power_consumption_of_last_7th_month":"477.57 kWh",
        "Power_consumption_of_last_8th_month":"477.29 kWh",
        "Power_consumption_of_last_9th_month":"477.24 kWh",
        "Power_consumption_of_last_10th_month":"477.19 kWh",
        "Power_consumption_of_last_11th_month":"477.19 kWh",
        "Power_consumption_of_last_12th_month":"476.23 kWh",
        "The_number_of_cover_meter_open":"5",
        "The_last_cover_open_time":"19-07-19 13:33",
        "The_last_2nd_cover_open_time":"19-07-17 08:43",
        "The_last_3rd_cover_open_time":"19-07-15 15:31",
        "The_last_4th_cover_open_time":"19-06-21 10:42",
        "The_last_5th_cover_open_time":"19-06-21 10:42",
        "The_last_6th_cover_open_time":"00-00-00 00:00",
        "The_last_7th_cover_open_time":"00-00-00 00:00",
        "The_last_8th_cover_open_time":"00-00-00 00:00",
        "The_last_9th_cover_open_time":"00-00-00 00:00",
        "The_last_10th_cover_open_time":"00-00-00 00:00",
        "The_number_of_power_down":"254",
        "The_last_power_down_time":"19-10-31 14:11",
        "The_last_2nd_power_down_time":"19-10-31 10:52",
        "The_last_3rd_power_down_time":"19-10-31 10:37",
        "The_last_4th_power_down_time":"19-10-31 06:08",
        "The_last_5th_power_down_time":"19-10-30 16:27",
        "The_last_6th_power_down_time":"19-10-30 16:25",
        "The_last_7th_power_down_time":"19-10-30 12:19",
        "The_last_8th_power_down_time":"19-10-30 12:12",
        "The_last_9th_power_down_time":"19-10-30 12:04",
        "The_last_10th_power_down_time":"19-10-30 11:57",
        "Voltage":"231.1129 V",
        "Current":"1.33 A",
        "Power":"0.0294 kW",
        "Date":"19-10-31 04",
        "Time":"18:18:22",
        "The_number_of_credit":"74",
        "Current_Credit_Register":"18733.95 kWh,ON",
        "The_last_credit_amount":"20002.4 kWh",
        "The_last_2nd_credit_amount":"500 kWh",
        "The_last_3rd_credit_amount":"500 kWh",
        "The_last_4th_credit_amount":"4200.4 kWh",
        "The_last_5th_credit_amount":"19902.4 kWh",
        "The_last_6th_credit_amount":"4975.4 kWh",
        "The_last_7th_credit_amount":"79602.4 kWh",
        "The_last_8th_credit_amount":"5979.4 kWh",
        "The_last_9th_credit_amount":"5970.4 kWh",
        "The_last_10th_credit_amount":"5473.4 kWh",
        "The_last_credit_token":"0000 0000 0000 0000 0000",
        "The_last_2nd_credit_token":"0000 0000 0000 0000 0000",
        "The_last_3rd_credit_token":"0000 0000 0000 0000 0000",
        "The_last_4th_credit_token":"0000 0000 0000 0000 0000",
        "The_last_5th_credit_token":"0000 0000 0000 0000 0000",
        "The_last_6th_credit_token":"0000 0000 0000 0000 0000",
        "The_last_7th_credit_token":"0000 0000 0000 0000 0000",
        "The_last_8th_credit_token":"0000 0000 0000 0000 0000",
        "The_last_9th_credit_token":"0000 0000 0000 0000 0000",
        "The_last_10th_credit_token":"0000 0000 0000 0000 0000",
        "The_last_management_token":"0000 0000 0000 0000 0000",
        "The_last_2nd_management_token":"0000 0000 0000 0000 0000",
        "The_last_3rd_management_token":"0000 0000 0000 0000 0000",
        "The_last_4th_management_token":"0000 0000 0000 0000 0000",
        "The_last_5th_management_token":"0000 0000 0000 0000 0000",
        "The_last_6th_management_token":"0000 0000 0000 0000 0000",
        "The_last_7th_management_token":"0000 0000 0000 0000 0000",
        "The_last_8th_management_token":"0000 0000 0000 0000 0000",
        "The_last_9th_management_token":"0000 0000 0000 0000 0000",
        "The_last_10th_management_token":"0000 0000 0000 0000 0000",
        "Protocol_version_number":null,
        "Dual_source_rate":"35,35",
        "Clear_tampered":null,
        "Clear_credit":null,
        "created_at":"2019-10-23 02:15:02",
        "updated_at":"2020-07-03 15:01:03"
    }
}

If an invalid API key is provided, this API endpoint returns a 401 status code with the response below

{
    "message":"API Key supplied is invalid or has expired"
}

Remote Reading Data Items

If you need to get a list of all remote/meter reading data items before initiating a remote reading request, this API Endpoint comes in very handy

API Endpoint
GET : https://vendapp.crestflowenergy.com/api/dataitems

This Endpoint returns the below response with a 200 OK status code if the API key is valid

JSON Response
[     {
        "id":1,
        "label":"Cumulative kWh consumption",
        "task_group":1,
        "created_at":"2019-11-11 12:17:05",
        "updated_at":"2019-11-11 12:17:05"
    },
    {
        "id":2,
        "label":"Power consumption of last month",
        "task_group":2,
        "created_at":"2019-11-11 12:17:05",
        "updated_at":"2019-11-11 12:17:05"
    },
    {
        "id":3,
        "label":"Power consumption of last 2nd month",
        "task_group":2,
        "created_at":"2019-11-11 12:17:05",
        "updated_at":"2019-11-11 12:17:05"
    },
    {
        "id":4,
        "label":"Power consumption of last 3rd month",
        "task_group":2,
        "created_at":"2019-11-11 12:17:05",
        "updated_at":"2019-11-11 12:17:05"
    },     {
        "id":5,
        "label":"Power consumption of last 4th month",
        "task_group":2,
        "created_at":"2019-11-11 12:17:05",
        "updated_at":"2019-11-11 12:17:05"
    },
    {...}
]

Read Meter

This API Endpoint is used to request remote meter reading of a logged on user

Request Header
X-API-KEY:[API key]
API Endpoint
POST : https://vendapp.crestflowenergy.com/api/readmeter
JSON Request
{
    "data_item":"Power"
}

This Endpoint returns the below sample response with a 200 OK status code if the API key and Data Item are provided and valid

JSON Response
{
    "id":1,
    "meter_id":1,
    "task_no":"3uc89449-1923-7812-816u-890scb066090",
    "meter_no":"40000000000",
    "create_date":"2020-07-05T05:49:51.033",
    "end_date":"2020-07-05T05:49:51.033",
    "status":"unknown",
    "data_item":"Power",
    "created_at":"2019-10-31 17:00:25",
    "updated_at":"2020-07-05 04:49:51"
}

If the user already has a pending reading request same as the one requested, the endpoint returns a 422 status code with the response below

{
    "message":"Pending reading request already exists for this data item"
}

If the value provided for data item is invalid, the endpoint returns a 422 status code with the response below

{
    "message":"API error - invalid meterNo or dataItem"
}

If an invalid API key is provided, this API endpoint returns a 401 status code with the response below

{
    "message":"API Key supplied is invalid or has expired"
}

Remote Reading Tasks

This API Endpoint returns remote reading task history of a logged on user, it shows both successful, pending and failed meter reading tasks

API Endpoint
GET : https://vendapp.crestflowenergy.com/api/remotereadingtasks?api_key=[API key]&page=[page number]

This Endpoint returns the below sample response with a 200 OK status code if the API key is valid

The page number in the request is optional, if this value is not provided - the Endpoint returns the first page of records. Response is paginated to 15 records.

JSON Response
{
    "data":[
        {
            "id":0,
            "meter_id":1,
            "task_no":"u4b474zb-ecaf-4dd9-984p-a86ab502c4wf",
            "meter_no":"40000000000",
            "create_date":"2020-07-03T18:00:23.003",
            "end_date":"2020-07-03T18:00:23.003",
            "status":"unknown",
            "data_item":"Dual-source rate",
            "created_at":"2019-10-31 17:00:46",
            "updated_at":"2020-07-03 17:00:22"
        },
        {
            "id":1,
            "meter_id":1,
            "task_no":"a990a47c-13eq-46r7-99ea-z11533959343",
            "meter_no":"40000000000",
            "create_date":"2020-07-03T18:00:21.783",
            "end_date":"2020-07-03T18:00:21.783",
            "status":"unknown",
            "data_item":"Current Credit Register",
            "created_at":"2019-10-31 17:00:28",
            "updated_at":"2020-07-03 17:00:21"
        },
        {...}
    ],
    "links":{
        "first":"https:\/\/vendapp.crestflowenergy.com\/api\/remotereadingtasks?page=1",
        "last":"https:\/\/vendapp.crestflowenergy.com\/api\/remotereadingtasks?page=5",
        "prev":null,
        "next":"https:\/\/vendapp.crestflowenergy.com\/api\/remotereadingtasks?page=2"
},
    "meta":{
        "current_page":1,
        "from":1,
        "last_page":5,
        "path":"https:\/\/vendapp.crestflowenergy.com\/api\/remotereadingtasks",
        "per_page":15,
        "to":15,
        "total":73
    }
}

If an invalid API key is provided, this API endpoint returns a 401 status code with the response below

{
    "message":"API Key supplied is invalid or has expired"
}

Thank you

2024 © Crestflow Energy