Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-FreshServiceTicket Parameters Invalid for required "Extent" and "Severity" #19

Open
ArroyoINEOS opened this issue Apr 3, 2024 · 1 comment

Comments

@ArroyoINEOS
Copy link

ArroyoINEOS commented Apr 3, 2024

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

@rasimmers
Copy link
Contributor

rasimmers commented Apr 6, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants