Invalid Ticket 'Source' options in '/api/v2/ticket_fields'

If I make a request to ‘/api/v2/ticket_fields’ I receive a JSON response with the following ‘source’ field entry:

[
    {
        "id": 000000000,
        "name": "source",
        "label": "Source",
        "description": "Ticket source",
        "position": 4,
        "required_for_closure": false,
        "required_for_agents": false,
        "type": "default_source",
        "default": true,
        "customers_can_edit": false,
        "label_for_customers": "Source",
        "required_for_customers": false,
        "displayed_to_customers": false,
        "created_at": "2017-12-21T00:00:00Z",
        "updated_at": "2020-01-27T00:00:00Z",
        "choices": {
            "Email": 1,
            "Portal": 2,
            "Phone": 3,
            "Forum": 4,
            "Twitter": 5,
            "Facebook": 6,
            "Chat": 7,
            "MobiHelp": 8,
            "Feedback Widget": 9,
            "Outbound Email": 10,
            "Ecommerce": 11,
            "Bot": 12,
            "Whatsapp": 13
        }
    }]

I use this to populate a dropdown list, but when I make a POST request to ‘/api/v2/tickets’ with the source field set to ‘12’ (Bot), I receive an error saying:

{"description":"Validation failed","errors":[
   {"field":"source","message":"It should be one of these values: '1,2,3,5,6,7,8,9,11,10'","code":"invalid_value"}
]}

If these options are invalid then why are they in the ‘ticket_fields’ endpoint as choices?

1 Like

We are able to reproduce this issue. We will be passing to the corresponding team :freshdesk: . Meanwhile, what is the use case in which you are trying to use this API?

1 Like

I am creating an application that can automatically submit tickets based on events that happen in another system. I don’t know how the Freshdesk account will be configured so I need to build the UI dynamically. I am finding this challenging though because some important things are missing such as which groups an agent belongs to etc. (you guys have an internal API which gives you this information, but I can’t seem to get this information without ‘admin’ account credentials). I also have to keep trailing different requests out to see which ones break because there is no documentation about which field combinations are invalid (such as no due-by dates allowed for pending/resolved/closed tickets).

Thanks for your quick reply by the way :slight_smile:

See my other ticket for more info: Ticket API issues

1 Like

The list of allowed values for the source field can be found at Freshdesk Tickets API documentation. The bot is not in the list and hence, the error is thrown. If you have are facing any challenges with the use case, please create a separate topic.

1 Like

Okay, thanks for your response. When can I expect the ‘source’ ticket field to be updated with only the allowed values?
Would it also be possible to add ‘Bot’ to the allowed values because this is the most appropriate value for my use-case

We will take the feedback to the corresponding team :freshdesk:. Thank you for pointing it out.

A post was split to a new topic: Unable to retrieve custom source IDs