We're doing some tests to see about creating tickets in Freshservice via the API. However, when doing so, we're receiving a validation error.
The code we're trying through the terminal is as follows:
curl -v -u APIKeyHere:X -H "Content-Type: application/json" -d '{ "description": "Testing creation of a ticket via the Freshservice API", "subject": "[test] Ticket creation via API", "email": "existing-contact@email.here", "priority": 1, "status": 2 }' -X POST 'https://domain.freshservice.com/api/v2/tickets'
APIKeyHere = my API Key as obtained through my profile in Freshservice
existing-contact@emai.here = Email Address of an existing contact
domain = our Freshservice subdomain name
When I run the above command, I receive the following error:
{"description":"Validation failed","errors":[{"field":"department_id","message":"It should be a/an Positive Integer","code":"missing_field"}]}
Looking through the API v2 documentation, "department_id" is not listed as a required field. This particular contact does have a Department/Company associated with the account (as do a majority of our contacts).
If an existing contact has any Departments/Companies added to their record, does that make the department_id field required? Or is this because we have Department/Company as a required field when submitting and close a ticket? (We have this set for both the agents and customers.)