• santhanam
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 6
    Replies

I hit a problem while trying to integrate with facebook.

 

While using stream.publish, the response message i got is: <error_msg>This API version is deprecated</error_msg>

 

 

// create the HTTP Request HttpRequest req = new HttpRequest(); //set the url to send the request req.setEndpoint('http://api.facebook.com/restserver.php'); req.setBody('method=stream.publish&message='+subjectLine); req.setMethod('POST'); system.debug('body of message at req.getEndpoint '+req.getEndpoint()); //create an HTTP object and use it to send the request Http http = new Http(); //send the request and get the response. HTTPResponse res = http.send(req); String resBody = res.getBody(); XmlStreamReader reader = new XmlStreamReader(resBody);

 

system.debug('The response is : '+resBody);

 

 

 

 

Is there any other method i am supposed to use?

 

I am trying to post a message in my "wall" in facebook. Can anyone help me out here?

 

Any kind of integration with facebook [which does not involve facebook toolkit as i am behind proxy and cant use it] and steps to do it will help me!

 

A similar post: http://community.salesforce.com/sforce/board/message?board.id=apex&message.id=16030

 

Thanks.

For every case logged, I have automated for suggested solutions to come in from twitter in the "Solution" object.

 

Now, How do I make these solutions appear in Google Search?

 

Does it help making the "Visible in Public Knowledge Base" checkbox to true?

 


Am I missing something obvious here?

 

Any suggestions appreciated! Thanks

I have an Apex code which has If, else if & else clause based on the record count of a particular list variable, i.e

 

       

for( List<Offer__c> alloffers : [select Id,Shell_Operating_Entity__c,Account__c,Account__r.Name,Stage__c,Name from Offer__c where Account__r.Shell_Operating_Entity__c =:SOU and Account__r.Customer_Category__c='I&c' and Stage__c!='Not Used' and createddate>=:startdate and createddate<=:enddate])
// so upto 10,000 records can be fetched           

{
                       
            System.debug('alloffers size : '+alloffers.size());
            
            for(Integer j=0; j<alloffers.size(); j++)
                {
                System.debug('****alloffers[j].Stage__c****  '+alloffers[j].Stage__c );
                if(alloffers[j].Stage__c == 'Accepted')
                    {
                        System.debug('****offAccMap.size****: '+offAccMap.size());
                        if(offAccMap.size() < 1000)
                            {  
                   
                            if(!offAccMap.containsKey(alloffers[j].Account__c))
                                {

                                offAccMap.put(alloffers[j].Account__c,1);
                                offerAccepted+=1;
                                }
                            }

                         else if(offAccMap.size() < 2000)
                            {
                             if(!offAccMap.containsKey(alloffers[j].Account__c))
                                {

                                //FURTHER LINES OF CODE............

 

 

 

In this particular code, I am not able to write test method for the lines executed as a result of the if statement (if(offAccMap.size() < 1000))....

 I understand that, I can insert a maximum of 500 records in a test method, 

 

But, if these lines of code is not covered, My test method is not reaching 75%.

 

Is there any work around for this to write a test method so that the if,else if part of the code is covered ?

I hit a problem while trying to integrate with facebook.

 

While using stream.publish, the response message i got is: <error_msg>This API version is deprecated</error_msg>

 

 

// create the HTTP Request HttpRequest req = new HttpRequest(); //set the url to send the request req.setEndpoint('http://api.facebook.com/restserver.php'); req.setBody('method=stream.publish&message='+subjectLine); req.setMethod('POST'); system.debug('body of message at req.getEndpoint '+req.getEndpoint()); //create an HTTP object and use it to send the request Http http = new Http(); //send the request and get the response. HTTPResponse res = http.send(req); String resBody = res.getBody(); XmlStreamReader reader = new XmlStreamReader(resBody);

 

system.debug('The response is : '+resBody);

 

 

 

 

Is there any other method i am supposed to use?

 

I am trying to post a message in my "wall" in facebook. Can anyone help me out here?

 

Any kind of integration with facebook [which does not involve facebook toolkit as i am behind proxy and cant use it] and steps to do it will help me!

 

A similar post: http://community.salesforce.com/sforce/board/message?board.id=apex&message.id=16030

 

Thanks.

Hey I was just wondering if anyone out there has managed to get Apex to call any of the functions available in the Facebook API. I know there are all kinds of connectors and such to pull data out of facebook, but I need to publish some stuff using the "Stream.publish" method (here are the docs for it Steam Docs).

I tried to roll my own post request using the @Future(callout=true) but no good, and since it's async I can't see any of the feedback.

 

Here was the request I built.

 

System.debug('Making future call to update Facebook Profile'); //construct an HTTP request HttpRequest req = new HttpRequest(); HttpResponse res = new HttpResponse(); Http http = new Http(); req.setEndpoint('http://api.new.facebook.com/restserver.php'); req.setMethod('POST'); req.setBody('method=stream.publish&api_key=[MY KEY WAS HERE]&target_id=1769004737&message=TEST&uid=1769004737'); req.setCompressed(true); // otherwise we hit a limit of 32000 res = http.send(req);

 

If anyone has any idea why that didn't work, or how i can even capture the results of what happened (I don't get any Apex errors, but it doensn't do what it is supposed to either) please let me know. Thanks.

 

I have an Apex code which has If, else if & else clause based on the record count of a particular list variable, i.e

 

       

for( List<Offer__c> alloffers : [select Id,Shell_Operating_Entity__c,Account__c,Account__r.Name,Stage__c,Name from Offer__c where Account__r.Shell_Operating_Entity__c =:SOU and Account__r.Customer_Category__c='I&c' and Stage__c!='Not Used' and createddate>=:startdate and createddate<=:enddate])
// so upto 10,000 records can be fetched           

{
                       
            System.debug('alloffers size : '+alloffers.size());
            
            for(Integer j=0; j<alloffers.size(); j++)
                {
                System.debug('****alloffers[j].Stage__c****  '+alloffers[j].Stage__c );
                if(alloffers[j].Stage__c == 'Accepted')
                    {
                        System.debug('****offAccMap.size****: '+offAccMap.size());
                        if(offAccMap.size() < 1000)
                            {  
                   
                            if(!offAccMap.containsKey(alloffers[j].Account__c))
                                {

                                offAccMap.put(alloffers[j].Account__c,1);
                                offerAccepted+=1;
                                }
                            }

                         else if(offAccMap.size() < 2000)
                            {
                             if(!offAccMap.containsKey(alloffers[j].Account__c))
                                {

                                //FURTHER LINES OF CODE............

 

 

 

In this particular code, I am not able to write test method for the lines executed as a result of the if statement (if(offAccMap.size() < 1000))....

 I understand that, I can insert a maximum of 500 records in a test method, 

 

But, if these lines of code is not covered, My test method is not reaching 75%.

 

Is there any work around for this to write a test method so that the if,else if part of the code is covered ?

Hello all !!

I have to do a find and replace a string on a variable (string). I know there is a matcher object but I couldnt find much documentation on the usage. Any one else used this object ? or is there any other simple function to get this done. Pls help

Thanks
Raghu


Message Edited by Raghu_dev on 05-14-2008 05:45 PM