2

I've been using the cloud environment, which works fine. I just recently downloaded the standalone version and am successfully running it on my ubuntu server. All the PHP SDK calls work, and the api/v1/data/[X Table Name] CuRL requests work.

However, I cannot get the CuRL request for valid login and logout to work. With the cloud implementation this was working:

function isValidToken($userToken){
    $ch = curl_init();
    $appId = APP_ID_FOR_CLOUD;
    $restKey = REST_KEY_FOR_CLOUD;
    $headers = array("application-id:$appId","secret-key:$restKey","application-type:REST");
    curl_setopt($ch, CURLOPT_URL, "https://api.backendless.com/v1/users/isvalidusertoken/" . $userToken);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);
    curl_close($ch);
    return $response;
}

This returns the proper response.

Now the only thing that changes are the IDs, keys, and URL, but it cannot find the requested URL. Here is the call to the standalone implementation:

function isValidToken($userToken){
    $ch = curl_init();

    $appId = APP_ID_STANDALONE;
    $restKey = REST_KEY_STANDALONE;

    $headers = array("application-id:$appId","secret-key:$restKey","application-type:REST");

    curl_setopt($ch, CURLOPT_URL, "http://[my_server_ip_address]/v1/users/isvalidusertoken/" . $userToken);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    $response = curl_exec($ch);

    echo curl_error($ch);

    curl_close($ch);

    return $response;
}

The response I get is:

The requested URL /v1/users/isvalidusertoken/35A977A7-60DB-3772-FFC9-29E72AFAA200 was not found on this server.

Does anyone know how to resolve this issue? Thanks in advance!

chaseshak
  • 301
  • 1
  • 9

1 Answers1

1

I was just able to figure this out, the issue was due to a simple typo in the URL. For anyone who may make the same mistake, the standalone URL (for isvaliduesrtoken) is:

http://[my_server_ip_address]/api/<your_app_version>/users/isvalidusertoken/<user-token>
chaseshak
  • 301
  • 1
  • 9
  • Your server URL is configured in backendless.config file, so this was not a typo, rather you just didn't know what actual API URL your Standalone server had. – Scadge Jul 24 '16 at 23:08