10
votes
How to Session ID for a curl request?
I tried Ashwani's trick. It looks like security removes session id's from logs now. Here's a quick workaround.
SYSTEM.DEBUG('Session Id : ' +Userinfo.getSessionId().reverse())
Then you can just grab ...
8
votes
Accepted
Connected App built in SANDBOX has access to PROD
This is a feature of OAuth, and is working as designed. A connected app clientId and secret can be used to connect to any org provided you go through oauth flow and enter username and password (or ...
7
votes
Rendering Email Thumbnail in Hub
The route listed in this question is unsupported. It should not be used in production environments. This route may stop working or become unavailable at any time with no notice.
5
votes
Accepted
Salesforce authentication failure
The critical note from OAuth 2.0 Username-Password Flow for Special Scenarios says:
When using the username-password flow with an API, create a field in the username and password login screen where ...
4
votes
Accepted
How to pass API endpoint URL containing \ to
I strongly suspect that something is going sideways because you're not properly escaping the non-safe URL characters (like \ and [); in a URL, they must be in a certain style known as "percent ...
4
votes
Help converting this cUrl to Apex?
It'd probably be best if you started as a String array:
// ...
String[] payloadParts = new String[0];
String[] toBindings = new String[] { '{"address": "+18005551212", "binding_type": "sms"}', '{"...
3
votes
Persistant INVALID_AUTH_HEADER with curl on macos
I finally found that the problem is related to Bash which interprets the '!' char in a specific way (command history if I understood well).
I found about the same question on the Unix stackexchange ...
3
votes
Accepted
3
votes
Can I get a refresh_token using cURL from the command line, or in Salesforce.com itself?
I think you'll be better off using JWT for oAuth. It's more predictable behavior. Here is a PHP github library that I've used that has a lot of the code - https://github.com/adhocore/php-jwt
To ...
3
votes
Accepted
JSON with backslash for CURL. Not able to generate Apex request class
When you invoke curl from the command line, you have to escape any double quotes that you include within any quoted string. The escaped quotes are interpreted by your shell (probably bash), not by ...
3
votes
Accepted
curl post request to marketingcloud REST API is returning InvalidOrMissingTo
I was using the incorrect Content-type ... It should be application/json
3
votes
Accepted
Calling a flow through REST api returns "http body is required" error
flow expect input parameters while calling through API so you need to pass blank input array if you are not passing any value. Update your body with following json
{
"inputs": [
{}
]
}
So your ...
2
votes
Accepted
cURL Error 51 when Posting to Force.com
Is there any other way to fix this?
In theory, yes. You can go to Setup > Security Controls > Certificate and Key Management, upload some new certificates, and assign them to your Site via custom ...
2
votes
salesforce rest api invalid session id error when using access token
I do not know php , but essentially there are 2 parts that your program need to cater for , curl command shown below. First, get the session id, then use session id in header to preform the action you ...
2
votes
Accepted
Can I Upload Remote PDF File to Account via PHP?
I am hoping that you are using Force.com PHP SDK. You can directly call attachment SOAP API with following code.
$url = "$instance_url/services/data/v20.0/sobjects/Attachment/";
$...
2
votes
Help converting this cUrl to Apex?
A request bin service can be helpful in showing exactly what curl generates for the outbound body content. The curl manpage is also helpful:
--data-urlencode
(HTTP) This posts data, similar to the ...
2
votes
Accepted
Convert cUrl to rest in Apex?
The following api can get you customer subscription
HttpRequest req1 = new HttpRequest();
req1.setMethod('GET');
String customerId='cus_HJ3f4cSLOxY9a6';
string endpoint='https://api.stripe.com/v1/...
1
vote
Accepted
windows curl authentication error
solution: https://stackoverflow.com/questions/10060093/special-characters-like-and-in-curl-post-data
replace
-d "password=<your_password_and_security_token>"
with
--data-urlencode &...
1
vote
Accepted
Download Attachment using php is not working for xlsm files
This got worked by removing the CURLOPT_HEADER option.
curl_setopt($ch, CURLOPT_HEADER, 1); //remove
1
vote
SFMC API call to 3rd party when unsubscribing
You'll have to use SOAP API and Update a Subscriber using the Update Method.
Create and Install a package to get your Client Id and Client Secret. Set the appropriate permissions.
Find your ...
1
vote
Accepted
Trying to run a sql activity thourgh a curl SOAP request - SoapAction incorrect?
It's a tag value which should be "Start" and your have it: <Action>Start</Action>. The SOAPAction is a different one. It's a header.
Try using a header like this: SOAPAction: Perform. ...
1
vote
BULK API cURL commands to GET 100k records from Account
According to the docs here, there is a way to do this without the new Bulk API 2.0. I've verified this method will eventually return all results 2000 records at a time.
If the initial query ...
1
vote
How to create a business account with the REST API
Ok so this is what ended up being the issue:
1. I wasn't using the correct RecordTypeId.
2. I needed to create a Contact that could reference the Business Account we had created.
3. After creating the ...
1
vote
Accepted
How to create a business account with the REST API
You're going to use the same endpoint. PersonAccounts are a weird Mashup of an entry in the Account table and an Entry in the Contact table. Linked by a foreign key Account.ContactId
That said you'll ...
1
vote
Accepted
salesforce rest api invalid session id error when using access token
The solution was
I defined my headers array as:
$headers = array(
"Authorization" => "OAuth " . $sf_access_data['access_token']
);
When i should have defined it as:
$headers = array(
"...
1
vote
Posting Jenkins build status to SFDC via rest API chatter
Check the section Post a comment with a binary file in Chatter REST API Developer Guide.
To post a comment the syntax should look as below.
curl -H "X-PrettyPrint: 1" -F 'json={ "body":{ "...
1
vote
Convert cURL to Salesforce APEX rest api
A good place to start would be to look at the documentation on HttpRequest.
Most everything should map fairly intuitively from cURL.
For example...
POST, GET, PUT, etc... are Http methods, so use ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
curl × 71rest-api × 19
php × 17
apex × 11
api × 11
oauth × 9
rest × 7
oauth2 × 7
httprequest × 6
marketing-cloud × 5
authentication × 5
bulk-api × 5
json × 4
force.com × 4
apexrest × 4
post × 4
email × 2
integration × 2
connected-apps × 2
session × 2
postman × 2
trigger × 1
javascript × 1
unit-test × 1
community × 1