2.1.1 • Published 3 years ago

fsm-sdk v2.1.1

Weekly downloads
7
License
Apache-2.0
Repository
github
Last release
3 years ago

NodeJS FSM-SDK to Interface with SAP Field Service Management APIs and Services.

Find more documentation and related information at SAP Field Service Management Documentation

Some illustrative cases are provided in the examples folder.


Build Status Coverage Status

npm version

Getting started

install from NPM

npm i fsm-sdk --save

using the sdk with credentials:

const fsm = require('fsm-sdk');

const client = new fsm.CoreAPIClient({

  // [mandatory] your client configuration
  clientIdentifier: '<your-clientIdentifier>',
  clientSecret: '<your-clientSecret>',
  clientVersion: '<your-clientVersion>',

  // [optional] oauth grant type, default=password
  authGrantType: 'password' | 'client_credentials' | undefined

  // [optional] | [mandatory] if oauth grant type password
  authAccountName: '<your-authAccountName>',

  // [optional] | [mandatory] if oauth grant type password
  authUserName: '<your-authUserName>',

  // [optional] | [mandatory] if oauth grant type password
  authPassword: '<your-authPassword>',

  // [optional] or default=FIRST
  authCompany: '<your-authCompany>',

  // [optional] provide verbose logs
  debug: true,

  // [optional] enable using custom oauthEndpoints
  oauthEndpoint: 'https://ds.coresuite.com/api/oauth2/v1',

  // [optional] client will cache token (helpful for writing integration tests)
  tokenCacheFilePath: './.myToken.json'

});

related doc's:


CoreAPIClient

The CoreAPIClient will return a Promise and is asynchronous by default.

Query for objects using CoreSQL

Provides the coreSQL and the dtos used in the query see Query API Documentation

const coreSQL =
  `SELECT
    sc.id,
    sc.subject
  FROM
    ServiceCall sc
  WHERE
   sc.id = '36A5626F65A54FE7911F536C501D151A'
  `;

await client.query(coreSQL, ['ServiceCall']);

CRUD object

related doc's:

Create a new object

const serviceCall = {
   id: fsm.CoreAPIClient.createUUID(), // => 36A5626F65A54FE7911F536C501D151A
   ...
};

await client.post('ServiceCall', serviceCall);

Read object by id

await client.getById('ServiceCall', '36A5626F65A54FE7911F536C501D151A');

Update object (providing full new version)

await client.put('ServiceCall', { ... });

Update object (providing only fields to change)

await client.patch('ServiceCall', {
    id: '36A5626F65A54FE7911F536C501D151A',
    subject: 'update-only-subject',
    lastChanged: 1535712340
  });

Delete object

await client.deleteById('ServiceCall', {
    id: '36A5626F65A54FE7911F536C501D151A',
    lastChanged: 1535712340
  });
lastChanged

The lastChanged field is used for optimistic locking. It's like a version-key you have to provide in order to update an object.

Support

In case you need further help, check out the SAP Field Service Management Help Portal or report and incident in SAP Support Portal with the component "CEC-SRV-FSM".

License

Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file.

2.1.1

3 years ago

2.1.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.0

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.0.1

3 years ago

1.0.0-rc7

4 years ago

1.0.0-rc8

4 years ago

1.0.0-rc9

4 years ago

1.0.0-rc10

4 years ago

1.0.0-rc6

5 years ago

1.0.0-rc5

5 years ago

1.0.0-rc4

5 years ago

1.0.0-rc3

6 years ago

1.0.0-rc2

6 years ago

1.0.0-rc1

6 years ago