Sugar 7 - REST Webservice not accepting Get/Post parameters?

Hello.

I'm using Sugar Enterprise 7.7.

I'm making a webservice that returns some data.

It uses two optional parameters: client ('cliente' in brazilian portuguese), and date ('data' in brazilian portuguese).

The link to call would be something like this, for example: http://siteurl/TestApiCatalogoRegistrosSandbox.php?data=21/06/2016

If one of them is not empty, it will add some condition to the SQL select clause.

In the webservice call it has some condition to convert POST / GET parameters to the $arguments array parameter, which would be called in the webservice main code as an $args array parameter. I tried both POST and GET options in the "call" method.

This didn't work, so I tried putting directly $_GET, $_POST, and $_REQUEST parameter in the webservice main code, and obviously it didn't work too...

What I'm doing wrong?

I attached two files:

  • "TestApiCatalogoRegistrosSandbox.php" is the webservice call code (the 'configApiSugarcrm.php' include in the code is only the credentials, the credentials are ok until now)
  • "EndpointsAccountsApi.php" is the main webservice code. The method that is called in the file is "catalogoRegistros".

The manifest file is correct, as it is calling the webservice, but without the extra parameters in the sql clause.

Any help would be appreciated.

Thanks.

Best Regards,

Ramon Marcondes

3073._TestApiCatalogoRegistrosSandbox.php.zip

0777._EndpointsAccountsApi.php.zip

  • Hi Ramon,

    Do you see any error somewhere?

    Because in your api call undefined variables called $arguments

    $chamada = call($url, $oauth2_token_response->access_token, 'POST', $arguments);

    I don't say it is because of that, but maybe because of that php fails and you don't notice it?

    Best Regards

    Tevfik Tümer

    Developer Support Engineer

  • Hi Tevfik.

    Sorry, I didn't noted this error, and some other simple things I forgot too.

    It was a simple question of creating an array for the variable $arguments, and passing it in the call method:

    $arguments = array(

      "data"=> $_REQUEST['data'],

      "cliente"=> $_REQUEST['cliente']

      );

    Thanks.

    Best Regards,

    Ramon Marcondes