strict;
use warnings;
use base qw( Plagger::Plugin );
use LWP::UserAgent;
use Encode;
use JSON qw(encode_json);
our $VERSION = "0.03";
sub register {
my ( $self, $context ) = @_;
$context->
my $ua = LWP::UserAgent->new;
my $res = $ua->post( $self->{remote}, [ payload => encode_json($payload) ] );
unless ( $res->is_success ) {
$context->log( error => "Notiying to Sl
'0.4';
use strict;
use warnings;
use LWP::UserAgent;
use Ceph::RadosGW::Admin::HTTPRequest;
use JSON;
use Moose;
use URI;
use URI::QueryParam;
use Ceph::RadosGW::Admin::User;
use namespace::autoclea
thod, $path, %args) = @_;
my $content = '';
my $query_string = _make_query(%args, format => 'json');
my $request_builder = Ceph::RadosGW::Admin::HTTPRequest->new(
method => $method,
pa
line, $res->content, $req->as_string);
}
if ($res->content) {
my $data = eval {
JSON::decode_json($res->content);
};
if (my $e = $@) {
die "Could not deserialize server response:
ackage Acme::Rando;
$Acme::Rando::VERSION = '0.1';
use strict;
use warnings;
use HTTP::Tiny;
use JSON;
use parent 'Exporter';
our @EXPORT = qw(rando);
=head1 NAME
Acme::Rando - Get a Random St
andom?source=starwars&format=json');
unless ($res->{success}) {
return "These aren't the droids you're looking for: $res->{reason}"
}
my $dat = JSON::decode_json($res->{content});
return
X = '_id';
my $content_types = {
json => 'application/json',
yml => 'text/x-yaml',
xml => 'application/xml',
dump => 'text/x-perl',
jsonp => 'text/javascript',
};
my %trigg
ub () {
my $conf = plugin_setting;
my $serializers = {
'json' => 'JSON',
'jsonp' => 'JSONP',
'yml' => 'YAML',
'xml' => 'XML',
'dump' => 'Du
$routes{$action} } => $triggers_map{get}
->( qr{$route/\Q$action\E\.(?<format>json|jsonp|yml|xml|dump)}
=> $sub );
push @{ $routes{$action} } =>
N
This document describes Web API provided by L<Web::Dash>.
=head1 ENDPOINT
=head2 GET /search.json
Makes a search with a Lens and returns the search results.
B<Query Parameters>
=over
=item C<
onse is a JSON object.
The C<error> attribute of the object is C<null>,
and the C<results> attribute of the object is an array of search results.
Each entry in the C<results> array is a JSON object r
response is a JSON object.
The C<error> attribute of the object describes the cause of the error.
B<Example>
Request to L<Wikipedia|http://en.wikipedia.org/> Lens.
GET /search.json?lens=net.lau
------------------------------------------------------
# Library Modules
use WWW::Mechanize;
use JSON::XS;
#----------------------------------------------------------------------------
# Variables
$mech->content;
}
sub _parse {
my $self = shift;
my $data;
eval { $data = decode_json($self->{content}) };
return $data unless($@ || !$data);
$self->{error} = $@ || 'no da
ge Mojo::JSONXS;
# ABSTRACT: provide faster JSON for Mojolicious apps using Cpanel::JSON::XS
use Cpanel::JSON::XS;
use Mojo::JSON;
use Mojo::Util 'monkey_patch';
my $BINARY = Cpanel::JSON::XS->new
el::JSON::XS->new->utf8(0)->allow_nonref(1)->allow_blessed(1)->convert_blessed(1);
monkey_patch 'Mojo::JSON', 'encode_json', sub { $BINARY->encode(shift) };
monkey_patch 'Mojo::JSON', 'decode_json',
atch 'Mojo::JSON', 'to_json', sub { $TEXT->encode(shift) };
monkey_patch 'Mojo::JSON', 'from_json', sub { $TEXT->decode(shift) };
monkey_patch 'Mojo::JSON', 'true()', sub { Cpanel::JSON::XS::true(
le);
use Digest::SHA1 qw//;
use Cookie::Baker;
use Plack::Util;
use Scalar::Util qw/blessed/;
use JSON::WebToken qw/encode_jwt decode_jwt/;
use Plack::Util::Accessor qw/
alg
secret
/;
sub pre
ding utf-8
=head1 NAME
Plack::Middleware::Session::Simple::JWSCookie - Session::Simple with JWS(JSON Web Sigmature) Cookie
=head1 SYNOPSIS
use Plack::Middleware::Session::Simple::JWSCookie;
Plack::Middleware::Session::Simple.
Session cookie include session metadata with signature using JSON Web Signature.
The session cookie prevents manipulation of the session ID,
and can detect the inv
E/plugins" );
use utf8;
use Crypt::Lite;
use Digest::SHA1 qw(sha1_hex);
use HTML::Entities;
use JSON;
use WWW::Mechanize;
use Labyrinth::Globals;
use Labyrinth::Variables;
#-----------------------
content=".Dumper($mech->content());
## Process data
#my $data = from_json($mech->content(), {utf8 => 1});
my $data = from_json($mech->content());
#print STDERR "data=".Dumper($data);
my ($found,$
Path, ["param1=$param1", "param2=$param2", ..]);
use Data::Dump qw(dump);
use JSON;
my $json = new JSON;
dump $json->decode($result);
=head1 DESCRIPTION
The module to connect to the api of the
I method C<$restPath> (with the given C<$params>, where applicable) and returns either undef or a JSON string.
=back
=head1 DEPENDENCIES
=over 8
=item L<WWW::Mechanize>
=item L<HTTP::Request>
=i
-
# Library Modules
use lib ( "$BASE/lib", "$BASE/plugins" );
use utf8;
use HTML::Entities;
use JSON;
use WWW::Mechanize;
use Time::Local;
use Labyrinth::Globals;
use Labyrinth::Variables;
#------
content=".Dumper($mech->content());
## Process data
#my $data = from_json($mech->content(), {utf8 => 1});
my $data = from_json($mech->content());
#print STDERR "data=".Dumper($data);
my %counts =
qw(set_param split_with_entities);
use Carp;
use Try::Tiny;
use Scalar::Util qw(weaken);
use JSON qw(to_json);
use Text::Xslate qw(html_builder html_escape);
use File::Spec;
use Encode ();
use JavaScr
te => 'error.tx', args => {error => $message},
code => $http_code
);
}
sub response_json {
my ($self, $res_code, $response_object) = @_;
my $message = try {
die "response
}
to_json($response_object, {ascii => 1})
}catch {
undef
};
if(defined($message)) {
return [
$res_code, ['Content-Type' => 'application/json; charset=ut
e Labyrinth::Variables;
use Crypt::Lite;
use Digest::SHA1 qw(sha1_hex);
use HTML::Entities;
use JSON;
use Time::Local;
use WWW::Mechanize;
#---------------------------------------------------------
ODS
=over 4
=item LoadUsers
Builds the API call to retrieve the users, and stores the returned JSON into
the database, referencing all the users within Act, who have been recorded as
a speaker and/
LoadTalks
Builds he API call to retrieve the talks for the conference event. Parses the
returned JSON, filtering the talks based on day, room and type into specific
categories and stores within the d
imple;
use Plack::Request;
use Plack::Builder ();
use Plack::App::File;
use Try::Tiny;
use JSON qw(decode_json);
use Scalar::Util qw(looks_like_number);
use List::Util qw(min);
use Carp;
use Exporter
;
$tl_mapper->connect('/statuses.json',
{method => '_handle_tl_post_statuses'}, {method => 'POST'});
$tl_mapper->connect('/ack.json',
{method =>
'_handle_tl_ack'}, {method => 'POST'});
$tl_mapper->connect('/updates/unacked_counts.json',
{method => '_handle_tl_get_unacked_counts'}, {method => 'GET'});
$tl_mapper
/timelines/home/statuses.json
C<< POST /timelines/home/statuses.json >> endpoint inputs statuses to the "home" timeline.
Statuses are in the HTTP request body, encoded in JSON.
You can input more th
o, Alice!", "user":{"screen_name":"Bob"}}]' \
http://127.0.0.1:5000/timelines/home/statuses.json
This time, the statuses have C<user.screen_name> fields.
L<BusyBird> renders this field as the p
bird_input_feed https://metacpan.org/feed/recent -p http://127.0.0.1:5000/timelines/home/statuses.json
=back
After that, you can see the imported feed items (in this case, Perl modules recently uplo
a status
$ curl -d '{"text":"hello, world!"}' http://localhost:5000/timelines/home/statuses.json
=back
See L<BusyBird::Manual::Tutorial> for detail.
=head1 DOCUMENTATION
=over
=item L<BusyB
quests with the message body,
data format of the body must be JSON encoded by UTF-8,
so C<Content-Type> header should be C<application/json; charset=utf-8>.
The data format of HTTP responses is deter
=item C<timeline> = STR (required)
Timeline name.
=item C<format> = {json,html} (required)
Response format. It is either C<json> or C<html>.
If C<html> format is specified, the response message is
s C<json>.
It is useful when you transfer statuses from one L<BusyBird> instance to another.
=back
B<Response>
In success, the HTTP response code is 200.
=over
=item *
If C<format> is C<json> an
d it's tests/attachments in an array of HASHREFs.
The idea would be that you then could encode as JSON/XML as a backup, or to facilitate migration to other systems.
The project hashes will be what yo
Web::Dash::Lens;
use Encode;
use Future::Q 0.012;
use AnyEvent::DBus 0.31;
use AnyEvent;
use JSON qw(to_json);
use Try::Tiny;
use Carp;
my $index_page_template = <<'EOD';
<!DOCTYPE html>
<html>
<he
ng) {
return $.ajax({
url: "search.json",
data: { lens: lens_name, q: query_string },
dataType: "json",
type: 'GET',
}).then(null, funct
in'],
[Encode::encode('utf8', $error)]
]);
});
};
}
sub _json_response {
my ($response_object, $code) = @_;
if(!defined($code)) {
$code = $resp
BusyBird::Manual::Status - Status object specification
=head1 SYNOPSIS
use JSON;
my $status = decode_json(<<'STATUS');
{
"id": "http://api.example.com/2291",
"create
in JSON format). It should be serializable to
JSON and deserializable from JSON.
=head1 FIELDS
The following fields in a status object is used by BusyBird.
Note that the following list uses JSON f