The 'salesforce.client' (AKA RestClient) service included in this module has been super useful for us outside of its integration with the other included modules like salesforce_pull.

We recently found that we could use the service with the Bulk API 2.0, but needed a couple of small changes to get it to send and receive CSV data. Currently the RestClient assumes that parameters send and data received from the Salesforce REST API is JSON.

Issue fork and merge request is on the way.

Issue fork salesforce-3226511

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jeffam created an issue. See original summary.

aaronbauman’s picture

Version: 8.x-4.x-dev » 5.0.x-dev
Status: Active » Needs work
Issue tags: +Needs tests

I added a comment in gitlab.

Also, need to update the test client to get existing tests working, and probably add some test coverage for this new feature.

Lastly, new features should be against 5.x please, and backported to 4.x

a-fro made their first commit to this issue’s fork.

jeffam’s picture

Here's an example of using RestClient::apiCall() for a Salesforce Bulk API 2.0 call: https://github.com/ilrWebServices/collegenet2sf/blob/1.x/src/CollegeNetT...

The main difference is that $params is a CSV string (rather than an array that gets JSON encoded) and the Content-Type header must be 'text/csv' rather than 'application/json'.

aaronbauman’s picture

This is looking good.
Will you be able to address the failing tests?

jeffam’s picture

Thanks for taking a look. Tests should all be passing now.

jeffam’s picture

Status: Needs work » Needs review
a-fro’s picture

Status: Needs review » Reviewed & tested by the community

  • AaronBauman committed e6575fb on 5.0.x authored by a-fro
    Issue #3226511 by a-fro, jeffam: Allow RestClient to handle non-JSON...
aaronbauman’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs tests

Merged.
Thanks for the contrib!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.