Search code examples
xmlapipluginsredmineticket-system

Connecting Redmine with a remote website


I bought a plugin for Redmine, called Helpdesk Plugin (http://redminecrm.com/projects/helpdesk/pages/1) which obviously is a ticketing system.

Is there anyway of connecting this specific plugin to a external website to extract ID's from the people that use the remote website and as they are uploading their ticket/issue we would know who that person was from a special ID. Maybe through a XML API? Or a Feed?


Solution

  • How to create the API depends on your set-up. Generally you would have one application (redmine plugin) get some data (probably json/xml encoded) from another application (external website) by going to a particular URL.

    so your client (redmine) would do a web request something like: (pseudocode)

    response = curl_get('https://my.external-app.com/api/ticket?id='+ticketID)
    external_people = json_decode(response)
    

    This is basically making a web-request to some url and de-serialising the response so that you have data-structure (array or object) that you can easily use in your code.

    Your external webapp would need to respond with the correct data, the easiest might be to place a script at /api/ticket that fetches the required data from your database and prints it out in some serialised format (xml/json):

    ticket_id = http_request_parameter('id') 
    // should do some validation here to prevent SQL-injection
    ...
    // get the ticket details matching the id
    sql_result = db_query_result("SELECT user_id from `issues` where id=" + ticket_id)
    //send the result
    print json_encode(sql_result)
    

    Once you have this working you may want to add API-keys so that only authorised applications can retrieve the data.