Creating a Case with an Attachment Using the JSON API



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.



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 '' \
--header 'Content-Type: multipart/form-data' \
--form 'request={
"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