Home Self-Service Portal - Community
image IT Monkey:   


Formal Cireson Support (phone, email, and web) is not included with the free Self-Service Portal – Community app. For trouble shooting assistance, take advantage of the Cireson Community to find answers to your questions. However, if you’d like to purchase a Support Package to access more formal Cireson Support (phone, email, and web), please contact us today to learn more on the pricing options.

Upload file with Cireson api

Michael_MyhreMichael_Myhre Premier Partner IT Monkey ✭
I am trying to use the api to upload an attachment, but are not succeeding.

In the api I see Projection/Commit has a parameter for fileAttachmentPath. Is this the one to use? How should it be used?

Answers

  • Nicholas_VelichNicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭
    edited July 2017
    I don't believe its currently possible/supported to upload a file attachment via the API. Would be a great feature request though!
  • Roland_KindRoland_Kind Partner Advanced IT Monkey ✭✭✭
    edited January 2018

    Hi Michael,


    ... a little bit late - but I searched for a solution, too and I developed the following approach which works for me (for creating new WorkItems with attachments / latest 2016 Version of the Portal 8.2.x)

    1) upload files using the following ajax call...

    formData.append('files', dataBlob); 
           $.ajax({
            type: 'POST',
            url: '/FileAttachment/UploadFile/'+workItem.BaseId+'?count='+idx+'&className=System.WorkItem.ServiceRequest',
            data: formData,    

    use the callback data as Input for the pageForm.viewModel.FileAttachment Array

    2) use the following post method to create the workitem

    var postData = encodeURIComponent(JSON.stringify({
           isDirty: true,
           current: workItem       
           }));  

          $.ajax({       
                  
           url: "/ServiceRequest/Save",
           type: "POST",       
           processData: false,
           ContentType: "application/x-www-form-urlencoded; charset=UTF-8",       
           data: "formJson="+postData,


    Hope this helps       

    regards



Sign In or Register to comment.