Get data from Salesforce using curl Salseforce
1.Using refreshtoken
#!/bin/sh MY_INSTANCE="miura2-dev-ed" CLIENT_ID="*** your client id ***" CLIENT_SECRET="*** your client secret ***" REFRESH_TOKEN="*** your refresh token ***" #---------------------------------------------- # Get Access token from Refresh token. #---------------------------------------------- RESULT=`curl -X POST https://$MY_INSTANCE.my.salesforce.com/services/oauth2/token -d "grant_type=refresh_token" -d "client_id=$CLIENT_ID" -d "client_secret=$CLIENT_SECRET" -d "refresh_token=$REFRESH_TOKEN"` ACCESS=`echo $RESULT | awk 'BEGIN{FS="access_token\":"}{print $2}' |awk 'BEGIN{FS=","}{print $1}' | sed -s 's/\"//g'` #---------------------------------------------- #Get data using Access token #---------------------------------------------- curl -s https://$MY_INSTANCE.my.salesforce.com/services/data/v52.0/sobjects/Account -H "Authorization: Bearer $ACCESS" -H "Content-type: application/json"
How to get a Refreshtoken. (Refresh token is valid for 365 days) Salesforce.