Code Monkey home page Code Monkey logo

service-now-phpclient's Introduction

Service-Now-PHPClient

Great to have all your Service-Now incidents, changes, tasks etc... on a beautiful dashboard for example !

How to use Service-Now-PHPClient ?

To use Service-Now-PHPClient, you must have to declare this in your files.

require_once("./SNClient/SNClient.php");

You need to use credentials to connect your website to Service-Now. (You have to create a generic account if possible or use a normal account. Here we used an account from a developper instance from Service-Now.)

$proxy = ""; //if you don't use proxy :)
$SNClient = new ServiceNowClient($instance, $username, $password, $proxy);

Here, we verify that we can login on Service-Now and we display all number of first 10 incidents ! (see parameters on Service-Now docs.)

if($SNClient->Authenticated()){
  foreach($SNClient->RetrieveAllRecords("incident", "sysparm_limit=10")->result as $incidents)
	{
    echo $incidents->number;
  }
}

You can get a field of an incident with his "sys_id"

  foreach ($SNClient->RetriveRecord("incident", "9c573169c611228700193229fff72400") as $key => $value) {
    echo $value->short_description;
  }

You can create record in a table ! Read the service-now doc to know all fields names.(All fields are available)

  $data_array = array(
    'short_description' => $short_description,
    'description' => $description,
    'urgency' => $urgency,
    'impact' => $impact,
    'state' => $state,
    'assignment_group' => $assignment_group,
    'caller_id' => $caller_id,
  );

  $SNClient->CreateRecord("incident", $data_array);

So, it's easy ? :)

You found a bug ?

Open an issue and I will correct this :)

If you resolve the issue by modify code, do a pull request and add your name in comment.

TODO

  • GET TableAPI
  • GET SYS_ID TableAPI
  • POST TableAPI
  • PUT TableAPI
  • PATCH TableAPI
  • DELETE TableAPI
  • Use Proxy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.