You need to sign in to do that
Don't have an account?
Project Managers
Sales Force API Response with an Error
Hello,
We have a bash script that get server name as an argument in order to send sales force a query for that server name, then the script reply back with the parameters values as the answer of that query.
In the last few weeks (we don't know exactly when the script start getting errors) every time the script is sending the queries to SF (regarding any server) we are getting empty values. The reason for the empty values is this error (from SF):
[ {
"message" : "Session expired or invalid",
"errorCode" : "INVALID_SESSION_ID"
} ]
We didn't change anything in the script and don't know why suddenly we start getting these errors.
Thanks,
Udi
We have a bash script that get server name as an argument in order to send sales force a query for that server name, then the script reply back with the parameters values as the answer of that query.
In the last few weeks (we don't know exactly when the script start getting errors) every time the script is sending the queries to SF (regarding any server) we are getting empty values. The reason for the empty values is this error (from SF):
[ {
"message" : "Session expired or invalid",
"errorCode" : "INVALID_SESSION_ID"
} ]
We didn't change anything in the script and don't know why suddenly we start getting these errors.
Thanks,
Udi
//
//Generated by AdminBooster
//
public class fromJSON{
public cls_0 0;
class cls_0 {
public String message; //Session expired or invalid
public String errorCode; //INVALID_SESSION_ID
}
public static fromJSON parse(String json){
return (fromJSON) System.JSON.deserialize(json, fromJSON.class);
}
static testMethod void testParse() {
String json= '[ {'+
' "message" : "Session expired or invalid",'+
' "errorCode" : "INVALID_SESSION_ID"'+
'} ]';
fromJSON obj = parse(json);
System.assert(obj != null);
}
}
Our code is working as follows:
We are sending our script a server name to query on. E.g. sfServerName is ag0002.prod.api.dc05
First, we sent to SF auth URL, our credentials to get a token, and do get a token. For example: {"access_token":"00D300000000NaN!AQsAQAACjqitu9OZE4ecpdeiAlFwSb07Xb7mEkHCtvjhPfpx_8QIugWKd5HgT0u82wNzdkG21Ypac1gIGNZFJFNN09BdpLUM","instance_url":"https://exlibrisgroup.my.salesforce.com","id":"https://login.salesforce.com/id/00D300000000NaNEAU/00560000001xTlYAAU","token_type":"Bearer","issued_at":"1441623210703","signature":"sRWlKwvmADlACXMbayKjhWidfRjzZI9D95QXw/39WA0="}
Second, we save that token to be used later on in our query, for example access_token is 00D300000000NaN!AQsAQAACjqitu9OZE4ecpdeiAlFwSb07Xb7mEkHCtvjhPfpx_8QIugWKd5HgT0u82wNzdkG21Ypac1gIGNZFJFNN09BdpLUM","instance_url":"https://exlibrisgroup.my.salesforce.com","id":"https://login.salesforce.com/id/00D300000000NaNEAU/00560000001xTlYAAU","token_type":"Bearer","issued_at":"1441623210703","signature":"sRWlKwvmADlACXMbayKjhWidfRjzZI9D95QXw/39WA0=
Then, we send SF a query (via our SF base URL) as follows which include the token we got before:curl -s https://exlibrisgroup.my.salesforce.com/services/data/v29.0/query?q=Select+ID,+Name,+bl_Envirnoment__r.Oracle_core_license__c,+bl_DNS_name_alias__c,+bl_Envirnoment__c,+bl_Geronimo_Server_Type__c,+bl_Geronimo_Status__c,+bl_Geronimo_Decommision_Date__c+from+bl_Server__c+where+Name+like+%27ag0002.prod.api.dc05%25%27 -H Authorization: Bearer 00D300000000NaN!AQsAQAACjqitu9OZE4ecpdeiAlFwSb07Xb7mEkHCtvjhPfpx_8QIugWKd5HgT0u82wNzdkG21Ypac1gIGNZFJFNN09BdpLUM","instance_url":"https://exlibrisgroup.my.salesforce.com","id":"https://login.salesforce.com/id/00D300000000NaNEAU/00560000001xTlYAAU","token_type":"Bearer","issued_at":"1441623210703","signature":"sRWlKwvmADlACXMbayKjhWidfRjzZI9D95QXw/39WA0= -H X-PrettyPrint:1
But getting an error back.
Our script wasn't change and was working since a month from now, we would like to know what was change in SF that produce this error.
Thanks!