cryptoloot icon indicating copy to clipboard operation
cryptoloot copied to clipboard

API problem

Open engr-Eghbali opened this issue 6 years ago • 6 comments

Hi. I used cryptoloot HTTP API like:

https://api.crypto-loot.com/user/balance?name=1256****156&secret=66f5610f5533e9bf****************e84891528dd0 and its responded : { "success": "false", "error": "invalid_secret" }

I copied "exact" key from dashboard. whats wrong?

engr-Eghbali avatar Mar 05 '19 09:03 engr-Eghbali

Send a POST request, don't use GET request.

Nalem14 avatar Mar 15 '19 20:03 Nalem14

@FlyingBlue Thanks for your response but cryptoloot documentation said Method: GET. By the way I tried with 'POST' method and there is no success cause of CORS policy error appeared.

Access to XMLHttpRequest at 'https://api.crypto-loot.com/user/balance' from origin 'http://miner22.dx.am' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

engr-Eghbali avatar Mar 15 '19 22:03 engr-Eghbali

Yes, but is POST.... the documentation said wrong method... Don't make post request in Javascript, you have a problem with the Origin of the request that is not allowed on other website by a client (js).

Make PHP post request.

<?php
//
// A very simple PHP example that sends a HTTP POST to a remote site
//

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,"https://api.crypto-loot.com/user/balance");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('name' => 'user1', 'secret' => 'b1349*****')));

// Receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$server_output = curl_exec($ch);

curl_close ($ch);

// Further processing ...
print_r($server_output);
?>

Nalem14 avatar Mar 15 '19 22:03 Nalem14

@FlyingBlue Appreciate for your help, it finally worked ! but there is something so strange! I received response after 3.6 minutes ! why so long?! how is this possible?!

engr-Eghbali avatar Mar 15 '19 22:03 engr-Eghbali

Your welcome ;-)

I don't know, I don't have that problem. Do you make local test or Server production test ?

Nalem14 avatar Mar 15 '19 22:03 Nalem14

@FlyingBlue This is server production test, I made a ticket and waiting for support, its unusual .

engr-Eghbali avatar Mar 16 '19 07:03 engr-Eghbali