function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Project ManagersProject Managers 

Sales Force API Response with an Error


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.


salesforce mesalesforce me
Hi .

//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);
Project ManagersProject Managers
Thank you for the respons!

Our code is working as follows:
We are sending our script a server name to query on. E.g. sfServerName is
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":"","id":"","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":"","id":"","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,+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, -H Authorization: Bearer 00D300000000NaN!AQsAQAACjqitu9OZE4ecpdeiAlFwSb07Xb7mEkHCtvjhPfpx_8QIugWKd5HgT0u82wNzdkG21Ypac1gIGNZFJFNN09BdpLUM","instance_url":"","id":"","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.