Hi,
I’m currently in the process of writing a PowerShell script to create tickets, but for some reason it keeps complaining about an invalid responder_id:
{@{field=responder_id; message=Invalid responder_id; code=invalid_value}}
I’ve tried several responder_id’s, that I fetched using a GET command, but it keeps returning the same error. One time it give a different error: not part of group_id (or something like that), which made sense as the id used was indeed not member of the used group_id. But even after using a responder_id that is part of the group_id it keeps returning above error.
Here’s my code:
$APIKey = "**MyApiKey**"
$EncodedCredentials = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $APIKey,$null)))
$HTTPHeaders = @{}
$HTTPHeaders.Add('Authorization', ("Basic {0}" -f $EncodedCredentials))
$HTTPHeaders.Add('Content-Type', 'application/json')
#API v2 URL
$URL = "https://mycompanydomain.freshservice.com/api/v2/tickets"
$Attributes = @{}
$Attributes.Add('description',"Test description, please disregard.")
$Attributes.Add('status', 2)
$Attributes.Add('subject',"Powershell ticket creation test")
$Attributes.Add('priority', 1)
$Attributes.Add('email',"mycompanyemail@mycompany.com")
$Attributes.Add('group_id', **groupId_integer**)
$Attributes.Add('responder_id', **responderId_integer**)
$Attributes.Add('category', "Software")
$Attributes.Add('source', 2)
$JSON = $Attributes | ConvertTo-Json
$JSON
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $URL -Headers $HTTPHeaders -Body $JSON -Method Post -ContentType "application/json"
current error:
description : Validation failed
errors : {@{field=responder_id; message=Invalid responder_id; code=invalid_value}}
If I leave out the group_id (same applies to leaving out responder_id) I get this error:
description : Validation failed
errors : {@{field=group_id; message=It should be of type Positive Integer; code=missing_field}}
So I have the following questions:
-
I’ve tried ID’s of different agents in our system, all to no avail, how can I retrieve valid responder_id’s?
-
According to the API V2 documentation neither group_id or responder_id are mandatory by default, what makes group_id and responder_id mandatory?
I have not tried the above using curl yet, but I am expecting the same errors tbh.
Any help on this issue is greatly appreciated!