I just installed today - the install process went without warning or error. Because I do not want tickets created via email, I have created a new API key and the associated IP address to use with my Sensu monitoring platform to create tickets directly. Even though the interface is not documented I am testing using curl. I am sending a JSON payload and assume a POST is required:

curl -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Token token=D4EE57DD2D584C184256FAB77894C100" -X POST -d '{"status":"alert", "details":"this_is_a_test"}' http://ticket.myhost.net/api/

I get no response and no ticket is created. I tried other paths and I see PHP codes or the "URL not supported" message. So I have a good connection.

I am running:

Debian Wheezy 2.6.32-042stab084.12 #1 SMP Mon Jan 27 00 MSK 2014 x86_64 GNU/Linux

Mysql Server version: 5.5.33-0+wheezy1

nginx version: nginx/1.4.4 //using the working osTicket configuration from the nginx site

Nginx log for osTicket:

xxx.xxx.xx.xx - - "POST /api/ HTTP/1.1" 302 5 "-" "curl/7.26.0"

There are no errors in the logs.

So Curl found ticket.myhost.net/api/.

Is this a configuration issue? Can I use the API with JSON to create tickets? Do I need to change the JSON payload?

Thanks

Dan

The api_ticket_create.php code works - tickets are being created I will see how I can integrate with the monitoring platform. I'll be back...

    3 years later

    Hi cano, Please have you find the error? I have the same issue, I use apache as local server when I create ticket using API everything works fine, I use the url like 'url'=>'http://localhost/osticket/api/http.php/tickets.json', and the key, but recently they've changed the production server from apache to nginx and the API doesn't work. I've tried to go through http://localhost/osticket/api/http.php/tickets.json the result I received is "URL not supported" message = good connection but in production server using http://mywebsite.com/api/http.php/ticket.json the result displayed is file not found or using url until http.php result "url not supported", but when I use the same URL to use API no error is displayed. How could I acces to api folder in nginx?

    5 years later

    canoedf Thank you for pointing out to that! Been in the same situation and couldn't get the curl method to work, tried so many things but whatever response it gave (often just list the json content) no ticket was ever created.

    Looking at api_ticket_create.php helped a lot and now tickets are being created. Thank you 🙂

    Write a Reply...