Using Created and Updated Date for Tickets API

Respondida

6 Comentários

  • Serge BERTAINA DUBOIS

    Hi Chris!

    The json date format for Zendesk APIs is:
    YYY-MM-DDTHH-mm-ssZ

    like:
    "created_at":"2022-06-16T13:36:05Z"

    You will therefore have to reformat your date in the json.

    Friendships,
    Serge.

    0
  • Chris Green

    Thoughts on the syntax/format to do that? 

    0
  • Serge BERTAINA DUBOIS

    Here is an example of python code to format the date correctly:

    At the beginning of the python code:

    import datetime

    Durring the code :

    Zendesk_Created_time = CreatedTime.strftime('%Y-%m-%dT%H:%M:%SZ')
    Zendesk_Updated_time = UpdatedTime.strftime('%Y-%m-%dT%H:%M:%SZ')

    Then in json :

    created_at : Zendesk_Created_time,

    updated_at : Zendesk_Updated_time,

    ...

    friendships,

    Serge.

    0
  • Chris Green

    Thanks that helped, but I'm wondering if 'created_at' and 'updated_at' are even supported for creating new tickets via the Ticket API? I have my formatting correct (see below), but it continues to set each date within the ticket to today's date/time.

     

    {
    "ticket": {
                "subject": "C&L Platform Request - Test",
                "requester": "cgreen@meazurelearning.com",
                "tags": "import",
                "status": "open",
                "created_at": "2022-06-15T10:01:00",
                "updated_at": "2022-06-15T10:01:00",
                "brand_id": 7708479157517,
                "group_id": 8298833890701,
                "ticket_form_id": 8297974053005,
                "comment": {
                    "body": "testing",
                    "public": "true"
                },
                "custom_fields": [
                  {
                    "id": 8298500333837,
                    "value": "Connect"
                  },
                  {
                    "id": 360043217471,
                    "value": "ABC"
                  },
                  {
                    "id": 8298331661197,
                    "value": "priority_3_standard"
                  },
                  {
                    "id": 8298425523469,
                    "value": "c_l_support_dev"
                  },
                  {
                    "id": 8550445685389,
                    "value": ""
                  }
                ]
            }
        }
    0
  • Serge BERTAINA DUBOIS

    Indeed, these fields may be read-only.

    Maybe you can create custom fields in date format to inject this information.

    Friendships,
    Serge.

    0
  • Sam Livingstone

    Hello Chris Green and Serge BERTAINA DUBOIS

     

    For creating legacy tickets, please use the Ticket Import API which would allow you to set the created_at date for the legacy tickets.

     

    • POST /api/v2/imports/tickets - This endpoint is used to create tickets with created_at date.

     
    Please review the documentation I have linked above if you have any questions. Thanks.

    0

Por favor, entrar para comentar.

Powered by Zendesk