0

Similar to vTiger web services: Permission to perform the operation is denied for query

I'm trying to query vTiger, but I'm using httpful so here's my code:

// vTiger: GET Query
// http://vtiger_url/webservice.php?operation=query&sessionName=[session id]&query=[query string] 

$query = "SELECT * FROM Surveys;";
$uri = $vTiger_uri . "?operation=query&sessionName=" . $sessionName . "&query=" . $query;
$response_j = \Httpful\Request::get($uri)->send();


$response = json_decode($response_j, true);

echo "<p>Query: " . $query . "</p>";
echo "<pre>";
print_r($response);
echo "</pre>";

And I get this back:

Array
(
    [success] => 
    [error] => Array
        (
            [code] => ACCESS_DENIED
            [message] => Permission to perform the operation is denied for query
        )

)

I fear I'm missing something very simple, but having checked answers that refer to Zend and Curl I just can't puzzle out why it doesn't work with httpful, something to do with encoding the query string? :-(

Cœur
  • 37,241
  • 25
  • 195
  • 267
Rupert
  • 1
  • 2
  • 2
    Possible duplicate of [vTiger webservice "ACCESS\_DENIED : Permission to perform the operation is denied for id"](http://stackoverflow.com/questions/15532107/vtiger-webservice-access-denied-permission-to-perform-the-operation-is-denied) – brnrd Dec 12 '15 at 23:25

1 Answers1

0

Silly me I kept seeing 'don't encode'... but in this way of doing I find I need to, so code becomes:

$query = urlencode("SELECT * FROM Surveys;");

and all well ;-)

Sorry for the bandwidth, but hopefully helpful for others!

Rupert

Rupert
  • 1
  • 2