When creating a ticket it seems the fields "Extent" and "Severity" are required, however the PS module seems to see them as invalid. Tried both via the New-FreshServiceTicket command below and via POST method shown below
$APIKey = "xxxxxxxx"
$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')
$URL = "https://xxxxxdomain.freshservice.com/api/v2/tickets"
$Attributes = @{}
$Attributes.Add('requester_id',xxxxxxxxx)
$Attributes.Add('subject',"Test subject")
$Attributes.Add('description',"Test description")
$Attributes.Add('group_id',xxxxxxxxxx)
$Attributes.Add('source',2)
$Attributes.Add('priority',2)
$Attributes.Add('status',2)
$Attributes.Add('severity',"Work is stopped")
$Attributes.Add('extent',"A single individual")
$JSON = $Attributes | ConvertTo-Json
$JSON
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $URL -Headers $HTTPHeaders -Body $JSON -Method Post
Invoke-WebRequest:
{
"description": "Validation failed",
"errors": [
{
"field": "severity",
"message": "It should be one of these values: \u0027Work is not impaired,Work is impaired,Work is stopped\u0027",
"code": "missing_field"
},
{
"field": "extent",
"message": "It should be one of these values: \u0027A single individual,An entire workgroup,An entire department\u0027",
"code": "missing_field"
}
]
}
############. If I do this with those fields specified, I get the below, otherwise I get the above
Invoke-WebRequest:
{
"description": "Validation failed",
"errors": [
{
"field": "extent",
"message": "Unexpected/invalid field in request",
"code": "invalid_field"
},
{
"field": "severity",
"message": "Unexpected/invalid field in request",
"code": "invalid_field"
}
]
}
ModuleType Version PreRelease Name
Script 0.1.6 FreshservicePS
When creating a ticket it seems the fields "Extent" and "Severity" are required, however the PS module seems to see them as invalid. Tried both via the New-FreshServiceTicket command below and via POST method shown below
$APIKey = "xxxxxxxx"
$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')
$URL = "https://xxxxxdomain.freshservice.com/api/v2/tickets"
$Attributes = @{}
$Attributes.Add('requester_id',xxxxxxxxx)
$Attributes.Add('subject',"Test subject")
$Attributes.Add('description',"Test description")
$Attributes.Add('group_id',xxxxxxxxxx)
$Attributes.Add('source',2)
$Attributes.Add('priority',2)
$Attributes.Add('status',2)
$Attributes.Add('severity',"Work is stopped")
$Attributes.Add('extent',"A single individual")
$JSON = $Attributes | ConvertTo-Json
$JSON
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $URL -Headers $HTTPHeaders -Body $JSON -Method Post
Invoke-WebRequest:
{
"description": "Validation failed",
"errors": [
{
"field": "severity",
"message": "It should be one of these values: \u0027Work is not impaired,Work is impaired,Work is stopped\u0027",
"code": "missing_field"
},
{
"field": "extent",
"message": "It should be one of these values: \u0027A single individual,An entire workgroup,An entire department\u0027",
"code": "missing_field"
}
]
}
############. If I do this with those fields specified, I get the below, otherwise I get the above
Invoke-WebRequest:
{
"description": "Validation failed",
"errors": [
{
"field": "extent",
"message": "Unexpected/invalid field in request",
"code": "invalid_field"
},
{
"field": "severity",
"message": "Unexpected/invalid field in request",
"code": "invalid_field"
}
]
}
ModuleType Version PreRelease Name
Script 0.1.6 FreshservicePS