Sponsored Content
Top Forums Shell Programming and Scripting Malformed session key while using Facebook API Post 302776603 by pandeesh on Wednesday 6th of March 2013 02:26:32 PM
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
 

8 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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
WWW::Facebook::API::Video(3pm)				User Contributed Perl Documentation			    WWW::Facebook::API::Video(3pm)

NAME
WWW::Facebook::API::Video - Facebook Video SYNOPSIS
use WWW::Facebook::API::Video; DESCRIPTION
Methods for accessing video with WWW::Facebook::API SUBROUTINES
/METHODS base Returns the WWW::Facebook::API base object. new Constructor. get_upload_limits( %params ) The video.getUploadLimits method of the Facebook API: $response = $client->video->get_upload_limits; upload( %params ) The video.upload method of the Facebook API: $response = $client->video->upload( title => $title, description => $description, data => $RAW_DATA, filename => $filename, # not in the official API, but might be useful ); N.B.: the default response format for this method is XML per the official Facebook documentation, but this module uses whatever format has been set in WWW::Facebook::API. DIAGNOSTICS
None. CONFIGURATION AND ENVIRONMENT
WWW::Facebook::API::Video requires no configuration files or environment variables. DEPENDENCIES
See WWW::Facebook::API INCOMPATIBILITIES
None reported. BUGS AND LIMITATIONS
No bugs have been reported. Please report any bugs or feature requests to "bug-www-facebook-api@rt.cpan.org", or through the web interface at <http://rt.cpan.org>. AUTHOR
David Romano "<unobe@cpan.org>" LICENSE AND COPYRIGHT
Copyright (c) 2010, David Romano "<unobe@cpan.org>". All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. perl v5.10.1 2010-03-13 WWW::Facebook::API::Video(3pm)
All times are GMT -4. The time now is 01:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy