Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Post method question #1

Open
bartclarkson opened this issue May 11, 2013 · 1 comment
Open

Post method question #1

bartclarkson opened this issue May 11, 2013 · 1 comment

Comments

@bartclarkson
Copy link

Hi David -

I'm having a bit of trouble with the post method of the rest client, implemented in a Symfony2.2 project.

By way of example, this throws a 404 error. The $postData is an array keyed by field_name.

$rest_client->post('services/data/v20.0/sobjects/Lead', $postData);

Client error response
[status code] 404
[reason phrase] Not Found
[url] https://na15.salesforce.com/services/apexrest/services/data/v20.0/sobjects/Lead

This, on the other hand, works perfectly

$rest_client->call('/services/data/v27.0/sobjects/Lead/describe', null);

What am I failing to grasp about proper usage of the post method, or is it not complete?

Thanks!
Bart

@bartclarkson
Copy link
Author

David -

While I did find that adding the first slash to the method '/services/data/v20.0/sobjects/Lead' changes the error from a 404 to a 400 Bad Request, I never did figure out a way to make the post work. Later, having switched to a few lines of CURL, I determined that I was missing a required (non-nillable) field, "Company". So there was really never any chance I was going to get this bundle's post call to work.

The larger issue, also demonstrated by the Call function, is throwing a Bad Request exception rather than an informative error message from Salesforce. Like when a query contains an invalid field, or a create is missing a required field. I rather assume this more an issue with the implementation of Guzzle, because a basic curl_exec does return this data.

So for now, I'm keeping your Soap-Client bundle for authentication, but have removed this Rest-API and the Guzzle bundles in favor of simply making my own Curl call/posts/error-handling.

Thanks for the code!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant