I am attempting to create a test ticket through API but I am getting the error below:

curl -X POST -H "X-API-Key: 1xxxxxxxxxxxxxxxxxxF" -H "Content-Type: application/json" -d '{"source": "API", "name": "John Doe", "email": "email@domain.com", "subject": "Test Ticket", "message": "This is a test message."}' https://tickets.domain.com/api/tickets.json
curl: (3) URL rejected: Bad hostname
curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535
curl: (3) URL rejected: Malformed input to a URL function
curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535
curl: (3) URL rejected: Bad hostname
curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535
curl: (3) URL rejected: Malformed input to a URL function
curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535
curl: (3) unmatched close brace/bracket in URL position 24:
This is a test message.}'
^

The key is enabled and matches my Public IP on my host where I am making the API calls
Admin Panel >Manage >API.

This is the contents of the "api" directory within my install path in IIS
![
](https://)

Here is my environment details:
IIS 10
Php 8.1.27
![
](https://)

    cortkny2024

    Apparently something weird is happening and causing cURL to throw an error about bad hostname, etc. Are you copying this from somewhere and pasting it before running it? If so, maybe try manually typing it all out yourself because what you posted above is what it should be.

    Cheers.

    4 days later

    I was copying it from Notepad++, even if I try to type it manually it returns with the same result.

      cortkny2024

      I’m not sure then. Since this issue is outside of osTicket you will need to google the error and try the top results.

      Cheers.

      Do we have a list of APIs that is available within osTicket?

      Im particularly looking for APIs to generate report on Closed,opened, pending ,work-n-progress, unassigned tickets

      Thank you,
      Knychtell

        cortkny2024

        Yes, it’s available in the documentation linked below:

        As you can see there are only two. One is the Ticket Creation API and the other is called "Tasks" which is simply Cron execution. Other than that we have no other APIs. Now, v2.0 will have a fully RESTful API and even something else on top of that which is super big and really amazing that I can’t really leak right now so definitely stay tuned for that!

        Cheers.

          Write a Reply...