ServiceNow::JSON - Absraction Library for ServiceNow JSON WebServices
Allows for easy use of the ServiceNow JSON REST api from perl. Supports both ServiceNow JSON and ServiceNow JSONv2 implementations.
use ServiceNow::JSON;
my $sn = new ServiceNow::JSON( instance => "my_sn_instance", user => "foo", password => "bar" );
my $record = $sn->get( "cmdb_ci_computer", "72542ce36f015500e5f95afc5d3ee423" );
my $records = $sn->getRecords( "cmdb_ci_computer", { serial_number => '1234567' } );
my $keys = $sn->getKeys( "cmdb_ci_computer", { active => "true" } );
my $update = $sn->update( "cmdb_ci_computer", { sys_id => '0014eca36f015500e5f95afc5d3ee4af' }, { cpu_name => "kevin_test_another" } );
my $insert = $sn->insert( "cmdb_ci_computer", { serial_number => "1234567" } );
my $multi_insert = $sn->insert( "cmdb_ci_computer", [ { serial_number => "222222" }, { serial_number => "111111" } ] );
my $delete = $sn->delete( "cmdb_ci_computer", '0014eca36f015500e5f95afc5d3ee4af' );
my $delete_multi = $sn->deleteMultiple( "cmdb_ci_computer", { serial_number => "111111" } );
If you need to use version 1 of the ServiceNow JSON API, pass legacy => 1 to the contructor. "Instance" in the contructor represents the part of the service now url that is before service-now.com. So instance.service-now.com.
Accepts a table/record name and a sys_id for that record, returns an arrayref with either 0 or 1 elements. The elements will be a hashref of the ServiceNow object.
Accepts a table/record name and a hashref of query terms, multiple terms are ANDed together, API does not support OR type clauses. Returns all objects in an arrayref that match that query.
Accepts a table/record name and a hashref of query terms. Returns an arrayref of sys_ids for all objects that match the query criteria.
Accepts a table/record name, a hashref of query parameters and a hashref of the changes you wish to make. Multiple query parameters are ANDed together, works the same as getRecords and getKeys. Returns an arrayref of the objects that were updated.
Accepts a table/record name and either an array or hashref of the data you wish to enter. If you pass an arrayref it will detect this and pass the call onto insertMultiple. Returns an arrayref of the records that were just created.
Accepts a table/record name and an arrayref of the records you want to insert. Returns an arrayref of the records that were just created.
Accepts a table/record name and a sys_id of the record you wish to delete. Will only ever delete a single record. Returns the record that you just deleted in an arrayref.
Accepts a table/record name and a hashref of query terms. Will delete ALL records that match those query terms. Returns arrayref of the objects that were deleted.
Moose
REST::Client
MIME::Base64
JSON
https://wiki.servicenow.com/index.php?title=JSON_Web_Service
https://github.com/klkane/servicenow-json
Kevin L. Kane, <kkane@cpan.org>
Copyright (C) 2014 by Kevin L. Kane
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2 POD Errors
The following errors were encountered while parsing the POD:
alternative text 'https://wiki.servicenow.com/index.php?title=JSON_Web_Service' contains non-escaped | or /
alternative text 'https://github.com/klkane/servicenow-json' contains non-escaped | or /
To install ServiceNow::JSON, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ServiceNow::JSON
CPAN shell
perl -MCPAN -e shell install ServiceNow::JSON
For more information on module installation, please visit the detailed CPAN module installation guide.