Skip to main content
Question

curl Linux vs Windows

  • August 2, 2022
  • 2 replies
  • 125 views

Hi,

we tried to create a ticket using API V2. As close as possible to the cull expessions provided by the tutorial. While running the curl expression under Linux all work fine, but not with Windows.

Expression:
curl -v -u *APIKEY*:X -F 'attachments[]=@/home/user/xxx.txt' -F 'subject=API Test' -F 'description=Attachement Test' -F 'email=mail@someISP.com' -F 'priority=1' -F 'status=2' -X POST 'https://XXX.freshservice.com/api/v2/tickets'

Error:
{"description":"Validation failed","errors":[{"field":"attachments","message":"It should be of type valid file format","code":"datatype_mismatch","nested_field":"attachments.[0]"}]}* Connection #0 to host XXX.freshservice.com left intact

We don’t understand why,
 

2 replies

zachary.king
Top Contributor ⭐
Forum|alt.badge.img+16
  • Top Contributor ⭐
  • August 16, 2022

Hello @MercuryF, you might need to send the content-type along in the request when using in Windows.

Just a thought. Hope it helps!


ekrasner
Community Debut
Forum|alt.badge.img+2
  • Community Debut
  • September 8, 2022

Also, you need to enclose everything in { } .  Here is the post example in the api doc … curl -v -u user@yourcompany.com:test -H "Content-Type: application/json" -d '{ "description": "Details about the issue...", "subject": "Support Needed...", "email": "tom@outerspace.com", "priority": 1, "status": 2, "cc_emails": ["ram@freshservice.com","diana@freshservice.com"] }' -X POST 'https://domain.freshservice.com/api/v2/tickets'