webhook = new WWW::Shopify::Model::Webhook({topic => "orders/create", address => $URL, format => "json"});
$sa->create($Webhook);
And that's all there is to it. To delete all the webhooks in a store
->{parent}, $specs) . ".json";
my ($decoded, $response) = $self->use_url('get', $url, $specs);
my @return = $self->{_decode_entities} ? (map { my $object = $package->from_json($_, $self); $object->a
he headers come in the form
#
# <https://gift-reggie.myshopify.com/admin/api/2019-10/customers.json?limit=75&page_info=eyJkaXJlY3Rpb24iOiJwcmV2IiwibGFzdF9pZCI6MTA0MTYyOTYxMDAyNywibGFzdF92YWx1ZSI6MT
@->code == 503);
my $db = $self->{_db};
$db->create({created => $currentDate, request_json => $request_json});
}
}
sub put_url {
my $self = shift;
eval {
$self->SUPER::put_url(@_);
};
if (
@->code == 503);
my $db = $self->{_db};
$db->create({created => $currentDate, request_json => $request_json});
}
}
sub delete_url {
my $self = shift;
eval {
$self->SUPER::delete_url(@_);
};
if ($@) {
die $@ unless ($@->code == 503);
my $db = $self->{_db};
$db->create({created => $currentDate, request_json => $request_json});
}
}
/bin/perl
use strict;
use warnings;
package WWW::Shopify::URLHandler;
use JSON qw(from_json to_json encode_json decode_json);
use Data::Dumper;
use Scalar::Util qw(weaken);
use DateTime;
use Encode;
0]->{_parent}; }
sub get_url {
my ($self, $url, $parameters, $type) = @_;
$type = "application/json" unless $type;
my $uri = URI->new($url);
my %filtered = ();
if ($parameters->{fields} && ref($
ls($1);
$self->parent->max_api_calls($2);
}
my $content = $response->decoded_content;
# From JSON because decodec content is already a perl internal string.
# Sigh. No. It's not. As per https://
_int($_[1]); }
package WWW::Shopify::Field::Boolean;
use Scalar::Util qw(looks_like_number);
use JSON;
use parent 'WWW::Shopify::Field';
sub sql_type { return "bool"; }
sub generate { return (rand()
sub data_type { return WWW::Shopify::Field::TYPE_BOOLEAN; }
sub to_shopify { return $_[1] ? JSON::true : JSON::false; }
sub from_shopify { return $_[1] ? 1 : 0; }
package WWW::Shopify::Field::Float;
n WWW::Shopify::Field::TYPE_QUANTITATIVE; }
# Freeform datastructure. Meaning we convert it to a JSON hash, but we don't do any further processing at all.
package WWW::Shopify::Field::Freeform;
use p
_token: " . $res->code() . ".\n" . $res->content) unless $res->is_success();
my $decoded = JSON::decode_json($res->content);
die new WWW::Shopify::Exception("Unable to refresh access token.") unless
_token: " . $res->code() . ".\n" . $res->content) unless $res->is_success();
my $decoded = JSON::decode_json($res->content);
die new WWW::Shopify::Exception("Unable to retrieve access token.") unles
e_filled { return qw(); }
sub needs_login { return 1; }
# Shopify recently just killed all their JSON apis for non-api stuff. Why? Who knows?
# They're just delaying the inevitable.
sub needs_form_en
package WWW::Shopify::GraphQL;
use strict;
use warnings;
use JSON qw(from_json decode_json encode_json);
use Encode;
use Scalar::Util qw(blessed);
use Data::Dumper;
sub new {
my ($package, $sa) =
ternal_query {
my ($self, $hash, $json) = @_;
my $request = HTTP::Request->new(POST => $self->sa->encode_url('/admin/api/' . $self->sa->api_version . '/graphql.json'));
my $content = ref($hash) ? e
ncode_json({ "query" => $content, "variables" => ($json || {}) });
$request->content($body);
$request->header('Content-Length' => length($body));
$request->header('Accept' => 'application/json');
oduct_reference variant_reference file_reference number_integer number_decimal date date_time url json boolean color weight volume dimension rating)]),
"value" => new WWW::Shopify::Field::MediumText(
ing and manipulating.
=item JSON-Like Hash: The item is similar to the WWW::Shopify::Model, but lacks all-non canonical shopify references, and is ready to be encode_json'd before being sent off to S
ts have to be accessed through their parent objects /product/3242134/variants/342342.json vs. /variants/342342.json
These tell you which objects have to go through their parent, and which don't. It t
e($metafield);
}
=head2 from_json($package, $json_hash, [$associated])
Returns a WWW::Shopify::Model::... intermediate object from a hash that's been decoded from a JSON object (i.e. normal shopify
ists" => new WWW::Shopify::Field::Boolean(),
"format" => new WWW::Shopify::Field::String::Enum(["json", "xml"]),
"requires_shipping_method" => new WWW::Shopify::Field::Boolean(),
"tracking_support"
tive" => new WWW::Shopify::Field::Boolean(),
"format" => new WWW::Shopify::Field::String::Enum(["json", "xml"]),
"carrier_service_type" => new WWW::Shopify::Field::String::Enum(["api"]),
}; }
sub c
e_filled { return qw(); }
sub needs_login { return 1; }
# Shopify recently just killed all their JSON apis for non-api stuff. Why? Who knows?
# They're just delaying the inevitable.
sub needs_form_en
ields { return $fields; }
BEGIN { $fields = {
"format" => new WWW::Shopify::Field::String("(xml|json)"),
"address" => new WWW::Shopify::Field::String::URL(),
"topic" => new WWW::Shopify::Field::St
/" . $self->api_version . "/locales/$locale_id.json", { s => \%mapping });
my $package = "WWW::Shopify::Model::Locale";
my $object = $package->from_json($decoded->{$package->singular}, $self);
retu
/api/" . $self->api_version . "/locale_translations/english_translations.json");
return map { my $object = $package->from_json($_, $self); $object; } @{$decoded->{$package->plural}};
}
sub update {
se = $self->url_handler->upload_url("POST", 'https://' . $self->shop_url . '/admin/settings/files.json', 'file', $item->key, ($item->content_type || "application/octet-stream"), $attachment);
die ne