0

I want to get results from this API as specified. But from what I know, I have tried to write some codes but it seems it doesn't work. I there any one can help me?

here is the API
http://1XX.XXX.XX.66:4848/SmartMeter/vms/credit?meterNumber=51751100044&amount=10&method=0&referenceNumber=12345678&return=JSON

Request Parameters - 
meterNumber: Meter Number(Like 51931000049)
amount: Amount(like 10 kWh,10 M³) or Currency( 10 $)
method: 0 means Amount, 1 means Currency
referenceNumber: a unique number to synchronize the request and
response(Like 12345678)
return: JSON, XML, TEXT (Return format)

{
    'code':'000',
    'description':'The command executed successfully',
    'meterNumber':'51931000049',
    'token':'19654220842452620628',
    'address':'china, jianshu, shuzhou',
    'referenceNumber':'12345678'
}

Edited by Hilal2009

2
Contributors
11
Replies
48
Views
1 Year
Discussion Span
Last Post by pritaeas
Featured Replies
  • 1
    pritaeas 1,949   1 Year Ago

    > I have no idea if you need to login to the API, or what else might be required. What is the URL of the API documentation? Read More

0

it doesn't work

You need to be more specific than that. What code do you use? What fails? What did you expect?

Edited by pritaeas

0

You need to be more specific than that. What code do you use? What fails? What did you expect?

Here is my codes

$curl=curl_init();        curl_setopt($curl,CURLOPT_URL,"http://1XX.XXX.XX.XX:4848/SmartMeter/vms/credit?meterNumber=51751100044&amount=10&method=0&referenceNumber=12345678&return=JSON");
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $result=curl_exec($curl);
    curl_close($curl);
    print_r($result);
0

What fails? What did you expect?

Answer those too, please. I have no idea if you need to login to the API, or what else might be required. What is the URL of the API documentation?

0

I got empty results, and I expect to get the following results

{
    'code':'000',
    'description':'The command executed successfully',
    'meterNumber':'51931000049',
    'token':'19654220842452620628',
    'address':'china, jianshu, shuzhou',
    'referenceNumber':'12345678'
}
1

I have no idea if you need to login to the API, or what else might be required. What is the URL of the API documentation?

0

I have no idea if you need to login to the API, or what else might be required. What is the URL of the API documentation?

Ok the issue is not to login to the API my friend,. According to API description, no login required, the only thing here is to use that API link with that parameters to return the values in JSON format as shown here

Link: http://1XX.XXX.XX.66:4848/SmartMeter/vms/credit?meterNumber=51751100044&amount=10&method=0&referenceNumber=12345678&return=JSON

Returned values:

{
    'code':'000',
    'description':'The command executed successfully',
    'meterNumber':'51931000049',
    'token':'19654220842452620628',
    'address':'china, jianshu, shuzhou',
    'referenceNumber':'12345678'
}

May be can I have your email address so I can forward the API document to you my friend?

0

I got empty results, and I expect to get the following results

Did you get an empty json result, or was there an error somewhere?

Is there a test call you can do that returns a result?

May be can I have your email address so I can forward the API document to you my friend?

No.

0

Did you get an empty json result, or was there an error somewhere? Is there a test call you can do that returns a result?

Yes my frend I get an empty json results

Edited by Hilal2009

0

If not one call yields results, better check with the provider of the API.

Have you tried with SoapUI?

Edited by pritaeas

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.