flycastpartnersinc / FreshservicePS

Powershell Module to interface with Freshworks Freshservice REST API.
MIT License
23 stars 5 forks source link

New-FreshServiceProblem attachments not working #1

Open rasimmers opened 1 year ago

rasimmers commented 1 year ago

Expected Behavior

New-FreshserviceProblem will create a problem with specified attachment(s).

Current Behavior

Error message from API: We're sorry, but something went wrong.

Possible Solution

As a workaround, create Problem without attachment(s) and then use Set-FreshServiceProblem to attach items.

Steps to Reproduce (for bugs)

  1. Create a new problem and specify the path to a file with -attachments:
    
    $newFreshServiceProblemSplat = @{
    requester_id = 21000418005
    description = "A new problem"
    status = 1
    impact = 1
    priority = 1
    subject = "A new problem"
    due_by = (Get-Date).AddDays(5)
    problem_impact = "This is the impact of this problem"
    known_error = $true
    category = "Hardware"
    sub_category = 'Peripherals'
    item_category = 'Router'
    problem_cause = "The cause of the problem"
    problem_symptom = "The symptom of the problem"
    **attachments = 'C:\Scripts\Attachments\attachment.txt'**
    }

$prob = New-FreshServiceProblem @newFreshServiceProblemSplat


2. Execute command and API produces: _We're sorry, but something went wrong._

## Context
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
Cannot create Freshservice Problems with attachments.
## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
* Module version used: 0.1.1
* Operating System and PowerShell version: Windows 11 with Powershell 7.3.4
rasimmers commented 1 year ago

This issue has been raised with Freshservice Product Management. Based on initial findings and behavior, it needs to be investigated as a bug in the Freshservice API. Attachments are supported with Invoke-WebRequest -Form and the same code is used in all API endpoints.