Community
Showing results for 
Search instead for 
Do you mean 
Reply

Download documents

New Member
Posts: 1
Country: Belgium

Download documents

Dear,

 

is it possible via the Web API to download the contents of the documents stored in Act?

 

Best,

Frederic.

Nickel Contributor m4y
Nickel Contributor
Posts: 546
Country: Belgium

Re: Download documents

@sburton@Xavier, can you help with this question please?

We're able to retrieve the local path of a document using the API but how to download it? Can you give some direction please?

 

Thanks in advance

 


Xavier Nyssen

ACT! Certified Consultant @ Intuitis | Belgium
{ +32 64 45 08 00 | xavier@intuitis.be | http://intuitis.be }
Employee
Posts: 109
Country: USA

Re: Download documents

[ Edited ]

You can download attachments in the SupplementalFiles section of the API:  The id will be the entity that the attachment is assigned.  For documents, it is attached to a history item.

 

Do a form-data post

 

/api/attachments/documents/{id}

Content-Type: application/x-www-form-urlencoded

 

 

Employee
Posts: 109
Country: USA

Re: Download documents

To upload a document, it requires a two step process.

 

first you need to post the history document entry, This is not the file it is a special history item in Act!.  To do this you would:

 

 

POST: api/documents

{
    "regarding":"Something",
    "startTime":"2016-03-28T15:00:00-07:00",
    "endTime":"2016-03-28T15:30:00-07:00",
    "companies": [
        {
          "id": "42896b1d-0b5d-4e60-9142-5927c73d9cf1",
          "name": "Swiftpage"
        }
    ],
    "isPrivate":false,
    "historyTypeID": -1,
    "details":"Test for Stephen"
}

 

 

The response of this request will provide you with an ID that is needed to update the file.  Now you can post the file.  Lets say, your response from the first post was { "id", "766415e0-539d-48eb-b90d-6da359e2259e", ... }

 

POST: api/attachments/documents/766415e0-539d-48eb-b90d-6da359e2259e
{
    "Authorization": "your token",
    "Content-Type": "application/x-www-form-urlencoded"
}

The document attachment is a formdata post:

//Mocha Sample would look like this:
{
    'formData': {
    'file': fs.createReadStream('./test/support_data/images/smiles1.jpg'),
},
    'headers': {
    'Authorization': token,
    'Content-Type': "application/x-www-form-urlencoded"
}

 

 

 

 

 

 

Highlighted
Employee
Posts: 109
Country: USA

Re: Download documents

The proper meta-type is really a multipart/form-data

 

Posting an Attachment to an Activity in Fiddler:

 

POST: http://localhost/act.web.api/api/attachments/activities/b0c2b211-b458-418d-91c1-6404647fd3d6

Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468
Authorization: Bearer eyJ0eXAiOiJKV1QiLC...

 

---------------------------acebdf13572468
Content-Disposition: form-data; name="fieldNameHere"; filename="images.jpg"
Content-Type: image/jpeg

 

<@INCLUDE *C:\Users\Stephen Burton\Desktop\images.jpg*@>
---------------------------acebdf13572468--