Ho to change "From:" details using REST API

Hi. I use REST API for RT 4.4.2 to create new tickets that is successful, however, when I look at the history of the ticket I notice that no matter what username/password and no matter what email I use for Requestor, “From” is always set with user root details (or superuser).

I want the see Requestor’s email in ticket history in front of “From:”, that is possible if I create the ticket via email but not via REST API.

Can someone please let me know how I can do it?

If you are using the root users credentials it makes sense that they are the creator of the ticket. Since the REST interface doesn’t use the email interface (It calls RT::Ticket->Create directly) the create process doesn’t check any header like ‘From’. Testing very quick I see that adding “Requestor” to a REST create call does set the requestor on the ticket though.

Maybe you could have a scrip set the creator to the requestor on ticket create for REST tickets? I am not sure if that creator is mutable or not though.

Thanks for your quick response. I tested it with non-root users credentials and the result is the same. I also set the Requestor without any effect besides setting the Requestor.

I also decided to give the user right to be the owner of the tickets, and set Owner on API call but no change again unless it set the Creator.

I’m wondering how the API chooses the root user for setting “From” email address. I also looked at all the scripts but none of them doing something related to this issue.

Thanks for your quick response. I tested it with non-root users credentials and the result is the same

I just tested with another user and basic auth and I see their name reflected as the creator of the ticket.

set the Requestor without any effect besides setting the Requestor.

This means the requestor is set? That is the right result right?

I’m wondering how the API chooses the root user for setting “From” email address. I also looked at all the scripts but none of them doing something related to this issue.

It is not checking the From address, if you look at the sub Create method for Ticket.pm that is what is being called by the API.

I’m using Postman right now. Let me try it with a PHP script and see if there’s any change.

Postman is what I am using as well! What do you have under the authorization tab?

Intersting! I have “Basic Auth”

In Postman you need to set the JSON content in the “Body” section, I use “raw” JSON:

{
    "Queue": "General",
    "Subject": "Create ticket test",
    "Content": "Testing a create",
    "Requestor": "me@example.com"
}

For your test user or root?

For your test user or root?

For test user

I’ve been using “form-data” but I’ll try raw JSON.
BTW, are you using /REST/1.0/ticket/new ? Don’t you need to use “id”:“new” in the data?

Oh I am sorry! I assumed this was REST2.0 interface, that makes sense why we see different behavior

Never mind. REST 2 is only available via an extension, correct?

Never mind. REST 2 is only available via an extension, correct?

Yeah it is an extension

I’ll try it with REST 2. Thanks