Bernhard Leitgeb

Custom API not visible

Discussion created by Bernhard Leitgeb on Dec 20, 2016
Latest reply on Dec 20, 2016 by Bernhard Leitgeb

Hey dear Sugar Community,

 

i have a Problem with my custom API. I want to write an API for XML export of Quotes.

In "http://localhost/sugarpro77/rest/v10/help" its not listed.

 

When i try to call it from "http://localhost/sugarpro77/rest/v10/Quotes/export" i just get this result:

 

{"error":"need_login","error_message":"No valid authentication for user."}


Here is the code of my API:



<?php

class OpenTansApi extends SugarApi
{
    public function registerApiRest()
    {  
        return array(
            'OpenTransExport' => array(
                'reqType' => 'POST',
                'noLoginRequired' => false,
                'path' => array('Quotes', 'export'),
                'pathVars' => array('',''),
                'method' => 'OpenTrans',
                'shortHelp' => 'OpenTrans XML export',
                'longHelp' => 'OpenTrans XML export',
            ),
        );
    }  
    public function OpenTrans($api, $args)
    {  
        return $args;
    }
}
?>


the path of my API is: "custom/clients/base/api/OpenTransApi.php".

 

 also tried the path:  "custom/modules/Quotes/clients/base/api/OpenTransApi.php"

but it didn't work either.

 

Would be awesome if you can tell me what I did wrong.

 

Thank You!

Outcomes