How to update field in salesforce using pub.client:http?

Hi Guys,

I’m trying to update fields in salesforce using the pub.client:http (patch method - method that was suggested to be used according to salesforce documentation) but I’m unable to perform successful http response.

These are the parameters I’ve configure when invoking the service pub.client:http

  1. url - https://{client}.salesforce.com/services/data/v54.0/sobjects/object__c/{external id}
  2. method - patch
  3. data/args/body(json string) - {“name”: “test”}
  4. header
    Authorization - Bearer {access token}
    Content-Type - application/json

These configuration returns below error

[{“message”:“MediaType of ‘application/x-www-form-urlencoded’ is not supported by this resource”,“errorCode”:“UNSUPPORTED_MEDIA_TYPE”}]

Note: I’ve tried the same configuration in postman using a patch method and a json body and it worked fine.

Any thoughts on how to fix this issue using http? if not, are there any other option that will work for on updating fields in salesforce?

Regards,
BG

Hi. The documentation for pub.client:http says, “When you submit data using args, Integration Server automatically sets the value of the Content-Type header to application/x-www-form-urlencoded.”

It also says, “For POST, PUT, and PATCH, you can specify only stream, bytes, or mimeStream.” In your case, mimeStream probably does not apply. You can supply the body as a byte array in data/bytes or as an InputStream in data/stream.

1 Like

@jctarro03
So you want to update Salesforce from an on-premise Integration Server?
If so, do you know about webMethods CloudStreams? It can be addd to the IS and can connect to various Cloud Providers, including Salesforce.
For info on why should you use CloudStreams, go here: Why do I need to go for CloudStreams - Forum - webMethods - Software AG Tech Community & Forums

Hi @michael6,

Thanks for your inputs.

I’ve tried to convert and supply the json data to data/bytes and data/stream. unfortunately, both are having below error. It seems the body is not being recognized. Am I missing something?

[{“message”:“The HTTP entity body is required, but this request has no entity body.”,“errorCode”:“XML_PARSER_ERROR”}]

Hi @wayne.leishman.20059,

Yes, I’m doing the update from an on-premise IS. I think cloudStreams isn’t configured to our IS. Any thoughts to make the update working in on-premise using http? by the way I’m using v10.7

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.