• PRABHAKARAN V 5
  • NEWBIE
  • 5 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hi,

I am trying to send JSON data and File data from the content version to REST callout using the content type "Multipart/form-data" with boundary in the APEX class. But, I am getting "Bad-Request" as the response Status and "400" as the response code.

If I send the same JSON data and file data to the REST callout using the "POSTMAN " tool, I receive a successful response.

Is there any other way to send JSON and file data in REST callout or any other body format needed for multipart/ form-data content type?

example of my body format:

------Boundary
Content-Disposition: form-data; name="jsondata"
Content-Type: application/json

{"id":"123","name":"test"}
-----Boundary
Content-Disposition: form-data; name="file"; filename="test.pdf"
Content-Type: application/pdf

file data
-----Boundary

regards,
prabhakaran
Hi,

I am trying to send JSON data and File data from the content version to REST callout using the content type "Multipart/form-data" with boundary in the APEX class. But, I am getting "Bad-Request" as the response Status and "400" as the response code.

If I send the same JSON data and file data to the REST callout using the "POSTMAN " tool, I receive a successful response.

Is there any other way to send JSON and file data in REST callout or any other body format needed for multipart/ form-data content type?

example of my body format:

------Boundary
Content-Disposition: form-data; name="jsondata"
Content-Type: application/json

{"id":"123","name":"test"}
-----Boundary
Content-Disposition: form-data; name="file"; filename="test.pdf"
Content-Type: application/pdf

file data
-----Boundary

regards,
prabhakaran
Hello There, I'm writing program to fetch newly created contact and save that into a list, it's partially done I'm able to fetch and print it but how to insert it into list. plz guide.
here's my code -

trigger ContactTrigger_query on Contact (before insert, before update) {
    
    List<Contact> aclist = new List<Contact>(); 
    
    Contact[] cont = [Select name, Account.Name from contact Where id IN : Trigger.new];
        System.debug(cont[0].name +' '+ cont[0].Account.Name);
    
}