Skip to content

Conversation

@ramakocherlakota
Copy link

apiRequest is a very useful method, encapsulating retry logic and
handling explicit HTTP result codes that we don't want to repeat in our
own code. It would be very helpful to expose it as a public method so
that, for instance, we can pass HTTP headers to SalesForce.

apiRequest is a very useful method, encapsulating retry logic and
handling explicit HTTP result codes that we don't want to repeat in our
own code.  It would be very helpful to expose it as a public method so
that, for instance, we can pass HTTP headers to SalesForce.
@jesperfj
Copy link
Owner

I am always wary of increasing the surface area of the API since it might make it harder for me to support the library in the future as a pure hobby effort. I do not yet consider anything in com.force.api.http as part of the public API. Your proposal would make HttpRequest and HttpResponse part of the public API in addition to apiRequest(), so it's quite an increase in surface area.

It would be helpful if you have some examples of headers you want to pass or other use cases made possible by this change.

@ramakocherlakota
Copy link
Author

HI Jesper,

Thanks for the fast reply - I totally see your point about expanding the API. Here's our use case: we need to pass the "Sforce-Auto-Assign" header with a value of FALSE in our HTTP request.

Before we realized about the header being required, we were able to get by with just calling ForceApi.createSObject passing in the type and the object. Maybe we could add a createSObject that also takes a Map<String, String> for headers to be passed in, in addition to the Accept and Content-type headers?

@vkolotov
Copy link

Hi All. Yeah definitely specifying some extra headers would a very good feature. A good example would be "If-Modified-Since" header for the "describe" method:
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_describe.htm

This would make interaction with SF a lot more efficient as far as I can see.

@jesperfj if I create a PR for just adding a new overloading method for ForceApi.describeSObject(String sobject), would that be acceptable for you? E.g. like that:

public DescribeSObject describeSObject(String sobject, Date sinceDate)

Would you be able to cut a new release after that? We do really need that feature asap :)

PS. Your library is awesome.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants