Start a conversation

Creating a Case with an Attachment Using the JSON API

Overview

Creating a case with attachment using the JSON API can be done similarly as with the XML API by changing the formatting according to how the FogBugz JSON API should be used.

 


Solution

When attaching a file you need to:

  • change Content-Type to multipart/form-data
  • add a text type parameter:
    • containing a JSON with all FogBugz parameters of the case, including cmd and token
    • The parameter's name does not matter.
    • Only the first text type parameter is processed.
  • add a file type parameter containing the path to the file to be attached.
    • The parameter's name should start with "File", otherwise, it will not be attached.
    • Add one such parameter for each file you would like to attach.

 

Example using curl:

curl --location --request POST 'https://yoursite.fogbugz.com/f/api/0/jsonapi' \
--header 'Content-Type: multipart/form-data' \
--form 'request={
"cmd":"new",
"token": "yourtoken",
"sTitle": "New case created via JSON API",
"sEvent": "This is the first comment for the case.",
}' \
--form 'File1=@/C:/Folder/Sample.txt'

 

Back to the top

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Priyanka Bhotika

  2. Posted
  3. Updated

Comments