Hi, i m sending http request to twitter by salesforce.com and getting this error.
"Twitter.TwitterApiException: Status: 500 Internal Server Error Content-Type: text/html

500 Internal Server Error

",
Can any1 help me to resolve this problem.

Thanks!

What are you using to issue the requests? What API call are you making?

while sending http request to twitter , it gives this error
Twitter.TwitterApiException: Status: 500 Internal Server Error Content-Type: text/html

500 Internal Server Error

my request format is

        string LogedInUser;
        LogedInUser=Userinfo.getuserId();
        Twitter.Share s = new Twitter.Share(); 
        Twitter link= new Twitter(LogedInUser); 
        s.text= 'Job vacancy';
        s.related='TestJob';
        s.url='www.google.com';
        link.updateUserShare(s);

my share class is

public class Share
{
public String text{get;set;}
public String related{get;set;}
public String url{get;set;}

    public Share()
    { }
    
    public DOM.Document toXML()
    {
        DOM.Document doc = new DOM.Document();
        Dom.XmlNode req=doc.createRootElement('tweet', null, null);

        if (text!= null || related!= null || url != null)
        {
            Dom.XmlNode body;
            body= req.addChildElement('text', null, null).addTextNode(text);
            body= req.addChildElement('related', null, null).addTextNode((related != null)?related:'');
            body= req.addChildElement('url', null, '').addTextNode((url != null)?url:'');
        }
        return doc;
    }
}

I want twitter status should be updated with the given text and url. i m using beta 1.0 sfdc-OAuth Playground package.
I think there is a problem in toXML() method, please look into it.

Thanks!
Asia Naseer.

create http request method

protected virtual HttpRequest createRequest(String path, String method, DOM.Document request)
{
HttpRequest req = new HttpRequest();
req.setEndpoint(‘https://twitter.com’ + path);
req.setMethod(method == null ? ‘GET’ : method);
req.setHeader(‘Content-Type’, ‘text/xml’ );
req.setTimeout(60000);
req.setBodyDocument(request);

    if (oa == null)
    {
        oa = new OAuth();
        if (!oa.setService('Twitter', sfdcUserId))
        {
            throw new AuthenticationException(oa.message);
        }
    }
    
    oa.sign(req);
    return req;
}

execute http request

protected virtual HttpResponse executeLinkedInRequest(HttpRequest req)
{
HttpResponse res = new Http().send(req);
if (req.getMethod() == ‘POST’ && res.getStatusCode() != 201)
{
throw new TwitterApiException (res.getBody()); // shows exception on this line.
}
else if (req.getMethod() == ‘GET’ && res.getStatusCode() != 200)
throw new TwitterApiException (res.getBody());

    return res;
}