Malformed session key while using Facebook API


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Malformed session key while using Facebook API
# 1  
Old 03-06-2013
Malformed session key while using Facebook API

Hi,

I am doing some experiments with facebook API and unable to update the status using the API.
My code is as follow as:
Code:
use WWW::Facebook::API;
use JSON::Any;

my $query=new CGI;
my $j = JSON::Any->new;
my $api_key="#MY API KEY#";
my $secret="#MY SECRET KEY#";
my $fb = WWW::Facebook::API->new( 
    desktop => 0, 
    api_key => $api_key, 
    secret  => $secret, 
    session_key => $query->cookie($api_key.'_session_key'),
    session_expires => $query->cookie($api_key.'_expires'), 
    session_uid => $query->cookie($api_key.'_user')
);

my $res = $fb->stream->publish( 
    message => 'Test message', 
    attachment => $j->objToJson( 
        { name => 'Foo bar baz', 
          href => 'http://www.google.com/', 
          description => "this is a thing" 
       } ), 
    action_links =>  $j->objToJson( 
      [ { text => 'action link text', 
          href => 'http://www.foobar.com/' 
      } ] ) 
);

In the original code, i replaced with original api and secret keys .
But i am receiving the below error an di don't have any clue how to fix this.

Code:
Odd number of elements in hash assignment at C:/Dwimperl/perl/site/lib/WWW/Facebook/API.pm line 164.
Error during REST stream.publish call:
params = 
    action_links:[{"href":"http://www.foobar.com/","text":"action link text"}]
    api_key:#api_key#
    attachment:{"href":"http://www.google.com/","name":"Foo bar baz","description":"this is a thing"}
    format:JSON
    message:Test message
    method:facebook.stream.publish
    session_key:session_expires
    v:1.0
response =
{"error_code":102,"error_msg":"Session key is malformed.","request_args":[{"key":"action_links","value":"[{\"href\":\"http:\/\/www.foobar.com\/\",\"text\":\"action link text\"}]"},{"key":"api_key","value":"#api_key#"},{"key":"attachment","value":"{\"href\":\"http:\/\/www.google.com\/\",\"name\":\"Foo bar baz\",\"description\":\"this is a thing\"}"},{"key":"format","value":"JSON"},{"key":"message","value":"Test message"},{"key":"method","value":"facebook.stream.publish"},{"key":"session_key","value":"session_expires"},{"key":"v","value":"1.0"},{"key":"sig","value":"fa1423663792249368fd00e9f102b992"}]}

Any thoughts on this.

Thanks in Advance!

--Pandeesh
# 2  
Old 03-07-2013
Which line is C:/Dwimperl/perl/site/lib/WWW/Facebook/API.pm line 164 ?

Maybe one of the parameters is missing, The odd hash says to me that a routine expecting "key, payload" pairs of arguments to put in a hash mapped container did not get pairs = even number. A hash mapped container looks up payload by key, and the key is hashed into an integer that is mod the bucket count to pick the bucket to search. For instance if key 'DGPickett' hashed to 123456 and there were 1000 buckets, the key and corresponding payload gets stored in bucket 456 for efficient random access. The key is rechecked on fetch, in case the bucket has someone else in it, too or only.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Remote Desktop Session Prints Warning Message Everytime I Hit One Specific Key

Hello All, My question has to do with a Remote Desktop Session going from my Linux HOST to a Windows GUEST. Linux OS: OpenSuSE 11.4 i586 Windows OS: Windows Server 2003 For some reason after I have run rdekstop to connect to the Windows Guest, whenever I click on the Shift key I get the... (0 Replies)
Discussion started by: mrm5102
0 Replies

2. UNIX for Dummies Questions & Answers

Sudo apt-get update fail: Malformed line 59

I am trying to update/add a repository. Whenever I try to do a sudo apt-get update I get the message: E: Malformed line 59 in source list /etc/apt/sources.list (dist parse) E: The list of sources could not be read. and when I do: gksudo gedit /etc/apt/sources.list I see... (1 Reply)
Discussion started by: kayak
1 Replies

3. Shell Programming and Scripting

Need to run an API from a script and extract fields from output of API

Hi, I need to call an API (GetUsageDetails)from inside a shell script which takes an input argument acct_nbr. The output of API will be like : <usageAccum accumId="450" accumCaptn="PM_125" inclUnits="1410.00" inclUnitsUsed="744.00" shared="true" pooled="false" prorated="false"... (1 Reply)
Discussion started by: rkrish
1 Replies

4. AIX

[Tip] /dev filling because of malformed IBM script

There is some IBM script out there, which contains a hidden syntax error. I am not sure which script it is (we are still investigating), but most of my HACMP systems (up to version 6.1) showed the symptom and i suspect the source to be in HACMP. Have a look at your system. Probably someone at... (1 Reply)
Discussion started by: bakunin
1 Replies

5. Shell Programming and Scripting

Need Suggestions to improve Perl script for checking malformed braces/brackets

Hi all, I've written a Perl script below that check and report for malformed braces. I have a UNIX ksh version and it took a couple of minutes to run on a 10000+ lines. With the Perl version it only took about 20 seconds so that is enough incentive for me to go Perl not to mention that I need... (1 Reply)
Discussion started by: newbie_01
1 Replies

6. Solaris

Sendmail 8.13.8 malformed address

Sending email produces malformed address error. The domain name appears as the active directory name which is not a valid Internet domain thus the malfomred address error. I have: divert(0)dnl VERSIONID(`@(#)sendmail.mc 1.11 (Sun) 06/21/04') OSTYPE(`solaris8')dnl... (0 Replies)
Discussion started by: crowman
0 Replies

7. Solaris

I am not able to login in gnome session and java session in Sun solaris 9& 10

I am not able to login in gnome session and java session in Sun solaris 9& 10 respectively through xmanager as a nis user, I am able to login in common desktop , but gnome session its not allowing , when I have given login credentials, its coming back to login screen, what shoul I do to allow nis... (0 Replies)
Discussion started by: durgaprasadr13
0 Replies

8. Shell Programming and Scripting

sqlplus session being able to see unix variables session within a script

Hi there. How do I make the DB connection see the parameter variables passed to the unix script ? The code snippet below isn't working properly. sqlplus << EOF user1@db1/pass1 BEGIN PACKAGE1.perform_updates($1,$2,$3); END; EOF Thanks in advance, Abrahao. (2 Replies)
Discussion started by: 435 Gavea
2 Replies
Login or Register to Ask a Question