Adding audio record to call log

Hi!
I’m trying to attach an audio file to an activity but I am keep getting Invalid multipart payload format error response. Request example:


The same request works in postman, could you help me?

Hi @Alexander
Welcome to the community :wave:
Can you share the complete error message? The following snippet should work fine with Unirest

var unirest = require('unirest');
var req = unirest('POST', 'https://api.pipedrive.com/v1/callLogs/<call_log_id>/recordings')
  .headers({
    'Accept': 'application/json',
    'Authorization': 'Bearer <Token>'
  })
  .attach('file', 'audio.wav')
  .end(function (res) {
    if (res.error) console.log(res.error);
    console.log(res.raw_body);
  });

@Hem Can you help me with my php code for the same ?

Hi @Shubham
One of the nifty features of our Postman collection is that it also generates runtime specific code snippets -

https://www.postman.com/pipedrive-developers/workspace/pipedrive-api-collection/request/14918448-08242983-ad22-4064-a6e7-d7815f7138a3?ctx=code

would this help ? Let me know :slight_smile:

@Hem actually I know that postman provides code for the request however , I don’t want to upload a single file , but multiple files to different deals , so I have to make it dynamic , so I don’t want to use postman since it includes cookies