package ServiceNow::JSON;
use Moose;
use REST::Client;
use MIME::Base64;
use JSON;
our $VERSION = 0.02;
has 'instance' => (
is => 'rw',
isa => 'Str',
);
has 'user' => (
is => 'rw',
, $table, $action, $json ) = @_;
my $api_version = "JSONv2";
$api_version = "JSON" if $self->legacy;
my $url = $table . ".do?$api_version&$action";
if( $json ) {
$self-
>client->POST( $url, to_json( $json ), { "Content-type" => 'application/json' } );
if( $self->client->responseCode != 200 ) {
print STDERR "ERROR!\n";
print STDERR $sel