T
Twenty4mo ago
azmat

How to pass attachment url in attachment creation API

I am trying to create atachments through API. I pass my file's s3 public url. But when I try to view the file I get the below error - {"statusCode":400,"message":"Folder https: is not allowed","error":"Bad Request"} My API request - curl https://api.twenty.com/rest/attachments \ --request POST \ --header 'Content-Type: application/json' \ --data '{ "name": "test attachmnet through api 2", "fullPath": "https://attachments-test-home.s3.ap-southeast-1.amazonaws.com/Twenty%20Hosted%20-%20%281%29.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-P", "type": "", "opportunityId": "a379099a-3013-42ee-b001-1581b14cbba1" }' I am not sure which url should I pass here. Any help is appreciated.
5 Replies
Prastoin
Prastoin4mo ago
Hello @azmat fullPath should not be an url "FOLDER/ID" Regarding
// file-folder.interface.ts
export enum FileFolder {
ProfilePicture = 'profile-picture',
WorkspaceLogo = 'workspace-logo',
Attachment = 'attachment',
PersonPicture = 'person-picture',
ServerlessFunction = 'serverless-function',
}
// file-folder.interface.ts
export enum FileFolder {
ProfilePicture = 'profile-picture',
WorkspaceLogo = 'workspace-logo',
Attachment = 'attachment',
PersonPicture = 'person-picture',
ServerlessFunction = 'serverless-function',
}
azmat
azmatOP3mo ago
@Prastoin So how does this work if I want the file in s3 and I want to create an attachment using the Create API for attachment. So does it mean I set the variables as shown in the screenshot and then I need to have a folder called "attachment" in the s3 bucket and save the file there and then make the api call that passes "attachment/file-name.png" in the fullpath
No description
azmat
azmatOP3mo ago
@prastoin please help me understand the correct usage of this api.
Prastoin
Prastoin3mo ago
Unless I'm mistaken if the folder does not exist it will get created when inserting in it Storage configuration is defined in order to hit your aws instances You need to upload the file then create the attachement
azmat
azmatOP3mo ago
@prastoin thanks ..let me try

Did you find this page helpful?