function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Guilhem AchikbacheGuilhem Achikbache 

[PHP/REST] Upload file to a personaccount

Hi everyone,

I'm trying to upload a file in the notes&attachment section of an account, but with no luck. The documentation is very obscure, and I can't even find with the workbench explorer a file that I've uploaded with the salesforce interface.

- What I can't find is where to POST the query :
/services/data/v20.0/sobjects/Account/{ID},
/services/data/v20.0/sobjects/Account/{ID}/Attachment,
/services/data/v20.0/sobjects/Account/Attachment{ID}
- what syntax shoud the JSON data have ? Where do I specify the recordId the file should be attached to ?
- how can I retrieve it later ?

does anyone know how to do this ?
Thanks
deepak balur 19deepak balur 19
https://help.salesforce.com/HTViewHelpDoc?id=loader_attachments.htm&language=en_US. Dataloader should be the way according to me.
Guilhem AchikbacheGuilhem Achikbache
Thanks for your answer, but i'm using the php rest api...
Guilhem AchikbacheGuilhem Achikbache
To whoever might be interested, the correct way to do it is :

POST to /services/data/v20.0/sobjects/Attachment
Body : 
{
parentId : the itemID you wish to attach the file to,
name : the filename
description: the description
body : base64encoded of file contents
contenttype: the mimetype of the file
}
Of all those fields, only the parentId, name and body seem to be displayed in the interface (lightning)