API usage

Submitted by roller on 2012-10-25

Hi folks

I want to add issues to Webissues from an application written in PHP. I want to login from that application, and add a new issue, without the login page of Webissues. I know I have to use the API but as I have some problem making it works, I am wondering if someone has written a simple ( and sample) code to make that.

Thanks

Giuseppe

What problem do you have? Perhaps I will be able to help you.

Regards,
Michał

Hi Michał
thanks for your attention. I just would write a little piece of code calling webissues API, that was able to create a new issue with some attribute. I succeeded in doing this calling the Index class api, but I can't get rid of the login page. I would like to insert a new issue without this login page popping up.

Greetings

Giuseppe

Hmm... the Index class is not the API, it's just the login page. The API classes are located in the system/api folder.

Regards,
Michał

Hi Michal

I could not find any documentation about how to do this. I tried to add calls

$sessionManager = new System_Api_SessionManager();
$result_login = $sessionManager2->login("xxx","yyyy", null);

$my_issue_manager = new System_Api_IssueManager();
$issueid = $my_issue_manager->addIssue( "1", $name, $arr);

to bottom of Index class, and it works fine (with the login popup, of course).

When I try to make same calls within a my class, it hangs without any message. maybe I miss same call ?

Giuseppe

You need to initialize a lot of things - load site settings, open database connection, etc.. Normally this is done by the System_Core_Application class or classes derived from it.

Regards,
Michał

Michał

lot of things.....maybe I am missing something. Is there any documentation about what you need to know of API, or you must discover how to do looking at code ?

Thanks

Giuseppe

You can generate a documentation from the comments using Doxygen or similar tool, but you will probalby still need to dig into the code.

Regards,
Michał

Hi Michał

sorry, but I can't get it working. Without few lines of documentation that explain the sequence of calls the server needs to create a session and to make a login , I could waste weeks of time with no guarantee of success. What's a pity. I have to try other solutions for our telemedicine project.

Anyway let me thank you for your attention and suggestions.

Regards
Giuseppe