Skip to content

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

Description

@ArroyoINEOS

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

Activity

  1. rasimmers commented on Apr 6, 2024

    @rasimmers
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions