I need to invoke a web service and extract what I need from the response using a combination of curl and xsltproc. However, any file-based parameters that must be supplied to both these programs must be from stdin and not actual files.
At least with curl, it seems to think that I am supplying a... (3 Replies)
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)
I have not used cUrl before, but I have noticed that in my Perl script I give a query and it takes the format:
URL?query={field;field}
But, when I try this with cUrl, it will not query at all:
curl: (3) nested braces not supported at pos 88
I have tried moving the braces etc etc, it... (1 Reply)
I would like to seek help on my LED REST API. I have finished constructed my basic REST API for my Raspberry PI. What I'm trying to do now is allow my LED to light up whenever I key localhost:3000/7/1 and key localhost:3000/7/0 to switch off. But my problem now is my REST API can't works and hope... (0 Replies)
Hi,
For one of our requirements, we are using curl command from a Linux box to call the servlet using PEM certificates type. Once servlet is trigger, the data will be loaded through servlet. If the servlet thread is completed successfully, then the control should return to Unix and based on... (0 Replies)
Hi All,
I am using below curl commad and getting output data correctly
curl -k -u AASSDD:PPOOII -d "output_mode=csv" --data-urlencode search='search source=*/AASSDDFF/PPOOLLKK**/94.0*ASD-RST* "Caused by" OR "Error: LISTENER WILL BE DISABLED" OR java.lang.reflect.InvocationTargetException |... (1 Reply)
hi,
i have curl command to POST a soap request to web service. I have a file (query.xml) which has all the soap message attached to it I just don't seem to be able to properly post it.
curl command
curl -s -H "Content-Type: text/soap+xml;charset=UTF-8" -H "SOAPAction:" -d @query.xml... (2 Replies)
We are not allowed to install curl on our linux box. Is there any other way to talk to Rest API's in shell script rather than using curl ? - Please advise - thank you (3 Replies)
Hello, Newbie here,
I have a perfectly well working web service call I can issue from chrome (PC Windows 10) and get the results I want (a dimmer being turned on in Fibaro Home Center 2 at level 40)
I am not allowed to post urls but the below works with http and :// and... (3 Replies)
Good afternnon. I need your help please to understand the basics of curl command to test web services.
Ive heard i can test a web service using this command,so:
curl http://glb_osb_fs.nh.inet:7110/serverglobal/services/StrategicPlanning/NotifyMNPAction_v1
it yields some errors, i would... (5 Replies)
Discussion started by: alexcol
5 Replies
LEARN ABOUT DEBIAN
lwp::authen::oauth
LWP::Authen::OAuth(3pm) User Contributed Perl Documentation LWP::Authen::OAuth(3pm)NAME
LWP::Authen::OAuth - generate signed OAuth requests
SYNOPSIS
require LWP::Authen::OAuth;
Google
# Google uses 'anonymous' for unregistered Web/offline applications or the
# domain name for registered Web applications
my $ua = LWP::Authen::OAuth->new(
oauth_consumer_secret => "anonymous",
);
# request a 'request' token
my $r = $ua->post( "https://www.google.com/accounts/OAuthGetRequestToken",
[
oauth_consumer_key => 'anonymous',
oauth_callback => 'http://example.net/oauth',
xoauth_displayname => 'Example Application',
scope => 'https://docs.google.com/feeds/',
]
);
die $r->as_string if $r->is_error;
# update the token secret from the HTTP response
$ua->oauth_update_from_response( $r );
# open a browser for the user
# data are returned as form-encoded
my $uri = URI->new( 'http:' );
$uri->query( $r->content );
my %oauth_data = $uri->query_form;
# Direct the user to here to grant you access:
# https://www.google.com/accounts/OAuthAuthorizeToken?
# oauth_token=$oauth_data{oauth_token}
";
# turn the 'request' token into an 'access' token with the verifier
# returned by google
$r = $ua->post( "https://www.google.com/accounts/OAuthGetAccessToken", [
oauth_consumer_key => 'anonymous',
oauth_token => $oauth_data{oauth_token},
oauth_verifier => $oauth_verifier,
]);
# update the token secret from the HTTP response
$ua->oauth_update_from_response( $r );
# now use the $ua to perform whatever actions you want
Twitter
Sending status updates to a single account is quite easy if you create an application. The "oauth_consumer_key" and "oauth_consumer_secret"
come from the 'Application Details' page and the "oauth_token" and "oauth_token_secret" from the 'My Access Token' page.
my $ua = LWP::Authen::OAuth->new(
oauth_consumer_key => 'xxx1',
oauth_consumer_secret => 'xxx2',
oauth_token => 'yyy1',
oauth_token_secret => 'yyy2',
);
$ua->post( 'http://api.twitter.com/1/statuses/update.json', [
status => 'Posted this using LWP::Authen::OAuth!'
]);
DESCRIPTION
This module provides a sub-class of LWP::UserAgent that generates OAuth 1.0 signed requests. You should familiarise yourself with OAuth at
<http://oauth.net/>.
This module only supports HMAC_SHA1 signing.
OAuth nonces are generated using the Perl random number generator. To set a nonce manually define 'oauth_nonce' in your requests via a CGI
parameter or the Authorization header - see the OAuth documentation.
METHODS
$ua = LWP::Authen::OAuth->new( ... )
Takes the same options as "new" in LWP::UserAgent plus optionally:
oauth_consumer_key
oauth_consumer_secret
oauth_token
oauth_token_secret
Most services will require some or all of these to be set even if it's just 'anonymous'.
$ua->oauth_update_from_response( $r )
Update the "oauth_token" and "oauth_token_secret" from an HTTP::Response object returned by a previous request e.g. when converting a
request token into an access token.
$key = $ua->oauth_consumer_key( [ KEY ] )
Get and optionally set the consumer key.
$secret = $ua->oauth_consumer_secret( [ SECRET ] )
Get and optionally set the consumer secret.
$token = $ua->oauth_token( [ TOKEN ] )
Get and optionally set the oauth token.
$secret = $ua->oauth_token_secret( [ SECRET ] )
Get and optionally set the oauth token secret.
SEE ALSO
LWP::UserAgent, MIME::Base64, Digest::SHA, URI, URI::Escape
Rationale
I think the complexity in OAuth is in the parameter normalisation and message signing. What this module does is to hide that complexity
without replicating the higher-level protocol chatter.
In Net::OAuth:
$r = Net::OAuth->request('request token')->new(
consumer_key => 'xxx',
request_url => 'https://photos.example.net/request_token',
callback => 'http://printer.example.com/request_token_ready',
...
extra_params {
scope => 'global',
}
);
$r->sign;
$res = $ua->request(POST $r->to_url);
$res = Net::OAuth->response('request token')
->from_post_body($res->content);
... etc
In LWP::Authen::OAuth:
$ua = LWP::Authen::OAuth->new(
oauth_consumer_key => 'xxx'
);
$res = $ua->post( 'https://photos.example.net/request_token', [
oauth_callback => 'http://printer.example.com/request_token_ready',
...
scope => 'global',
]);
$ua->oauth_update_from_response( $res );
... etc
Net::OAuth, OAuth::Lite.
AUTHOR
Timothy D Brody <tdb2@ecs.soton.ac.uk>
Copyright 2011 University of Southampton, UK
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself
perl v5.12.3 2011-03-31 LWP::Authen::OAuth(3pm)