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
HeliusHelius 

Really slow API feed-item calls

Hey all, got a few questions.

 

I'm making php curl calls to things like $instance_url . '/services/data/v28.0/chatter/feeds/record/0F9C0000000L1xzKAC/feed-items?limit=6, $instance_url being login.salesforce.com (I tried na8.salesforce.com, no difference). The time for this request like lke 2+ seconds. Shouldn't this be quicker? I am also right after it calling comments from another section of code and that doubles the load times.

 

I can replicate the slowness from multiple servers and networks.

Any suggestions?

 

Here is some sample code:


        //set Access Token given by salesforce oauth/oauth_callback
        $access_token = $_SESSION['access_token'];
        $instance_url = $_SESSION['instance_url'];


        if (!isset($access_token) || $access_token == "") { die("Error - access token missing from session!"); }
        if (!isset($instance_url) || $instance_url == "") { die("Error - instance URL missing from session!"); }


        //MAIN variables
        //set Url to use - Change ID to all group (https://na1.salesforce.com/services/data/v28.0/chatter/users/me/groups)
        $url =  $instance_url . '/services/data/v28.0/chatter/feeds/record/0F9C0000000L1xzKAC/feed-items?limit=6';
        // START OF CURLOPT // BEGIN FORMING CURL COMMAND
        $curl = curl_init($url);
            curl_setopt($curl, CURLOPT_URL, $url);
            curl_setopt($curl, CURLOPT_HEADER, 0);
            curl_setopt($curl, CURLOPT_HTTPHEADER, array("Authorization: OAuth $access_token"));
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl,CURLOPT_ENCODING,'gzip');
        //HANDLE THE RESPONSE
        $json_response = curl_exec($curl);
        $all_response = json_decode($json_response, true);
        curl_close($curl);

Vinita_SFDCVinita_SFDC

Hello Helius,

 

I tried to query few records through workbench and for me it took .632 second to give response. Please note that workbench is also rest api based like chatter API.

 

I would suggest you to find if where is it taking much time while making the request, you can find this either via fiddler, IE developer tools, firebug or press F12 in chrome and click networks.

 

Let me know your findings.