Twitter API profile_image_url didnt showing image URL always

profile

#1

I am using Twitter API in Salesforce and using search to fetch users/profiles.
i am making an HTTP get Request with endpoint as :

https://api.twitter.com/1.1/statuses/user_timeline.json?count=20&exclude_replies=false&include_rts=true&user_id=’+twitter_userid+’&screen_name=’+twitter_userid;

Now i am fetching “profile_image_url” field form response of this request and saving the profile image url in the backend. But somehow , the image url i.e. profile_image_url is not coming up always.
Please suggest me a way to rectify this , as this is a critical issue for me.


#2

I don’t know the details of the Salesforce integration. However, I’ve just called this using the twurl tool and I’m consistently getting that field completed. Can you show the JSON output from the call?

Couple of tips:

  1. I’d probably suggest using profile_image_url_https so you’re later fetching the image securely.
  2. You don’t need to use both the user ID and the screen name (and actually it looks like you are passing the same value into both parameters, which I would not expect to work). Just use e.g. screen_name and pass in the @handle.