Forum Discussion

PatoSalazar's avatar
10 years ago
Solved

500 status after api call

Hi,

I am stuck trying to make an anonymous call to the V2 Rest Api. I am using Curl

 

Documentation says that you don't need any oauth to if you only want to read data. But I am getting this response

 

{"status":"Internal Server Error","message":"Internal Server Error","statusCode":500}

 If someone has any inputs please let me know. Do I need to enable anything before doing the API calls?

 

The query I am using come straight from the examples given by the Lithium Documentation.

 

thanks in advance 

  • The Curl is fine. Lithium just sent me an email saying that they had given me the wrong client-id...Thanks for your help OlivierS

3 Replies

  • This is my curl command OlivierS (I have removed the real client-id and tenant-id )

     

      $url = "https://api.lithium.com/community/2.0/myTenantId/search?q=SELECT+*+FROM+messages%3D0&api.pretty_print=true";
    
    
    // Get cURL resource
    $curl = curl_init();
    // Set some options 
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(
        "content-type: application/json",
        "client-id:  MyClientID"	
        ));
    
    // Send the request & save response to $resp
    $resp = curl_exec($curl);
    
    // Close request to clear up some resources
    curl_close($curl);

    Any help would be greatly appreciated. I just want to perform a search using an anonymous call.

  • PatoSalazar's avatar
    PatoSalazar
    Ace
    10 years ago

    The Curl is fine. Lithium just sent me an email saying that they had given me the wrong client-id...Thanks for your help OlivierS