{"id":15023968,"url":"https://github.com/sap/fsm-sdk","last_synced_at":"2025-10-19T18:31:04.090Z","repository":{"id":47010869,"uuid":"249399781","full_name":"SAP/fsm-sdk","owner":"SAP","description":"A client library that provides APIs to call Services/APIs from SAP Field Service Management (aka CoreSystems). ","archived":false,"fork":false,"pushed_at":"2024-08-26T14:37:39.000Z","size":954,"stargazers_count":3,"open_issues_count":9,"forks_count":6,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-01-30T00:51:11.056Z","etag":null,"topics":["fsm","nodejs-sdk","sap"],"latest_commit_sha":null,"homepage":"https://help.sap.com/viewer/product/SAP_FIELD_SERVICE_MANAGEMENT/Cloud/en-US","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SAP.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-23T10:27:03.000Z","updated_at":"2024-08-26T14:37:42.000Z","dependencies_parsed_at":"2024-08-26T17:03:20.636Z","dependency_job_id":"351ea114-3cc5-4dd4-91b8-c9e44f81f4df","html_url":"https://github.com/SAP/fsm-sdk","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP%2Ffsm-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP%2Ffsm-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP%2Ffsm-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP%2Ffsm-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SAP","download_url":"https://codeload.github.com/SAP/fsm-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237191500,"owners_count":19269718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fsm","nodejs-sdk","sap"],"created_at":"2024-09-24T19:59:39.742Z","updated_at":"2025-10-19T18:31:04.084Z","avatar_url":"https://github.com/SAP.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SAP Field Service Management SDK \n\n[![npm version](https://badge.fury.io/js/fsm-sdk.svg)](https://badge.fury.io/js/fsm-sdk) ![integration test](https://github.com/SAP/fsm-sdk/workflows/integration%20test/badge.svg) [![REUSE status](https://api.reuse.software/badge/github.com/SAP/fsm-sdk)](https://api.reuse.software/info/github.com/SAP/fsm-sdk) ![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/GauSim/ef8d97285399b9ccfd8acf9e0796cd16/raw/fsm-sdk-badge.json) \n\n---\n\n## JavaScript SDK to Interface with SAP Field Service Management APIs and Services.\nFind more documentation and related information at [SAP Field Service Management Documentation](https://help.sap.com/viewer/product/SAP_FIELD_SERVICE_MANAGEMENT/Cloud/en-US)\n\n\n- [SAP Field Service Management SDK](#sap-field-service-management-sdk)\n  - [JavaScript SDK to Interface with SAP Field Service Management APIs and Services.](#javascript-sdk-to-interface-with-sap-field-service-management-apis-and-services)\n  - [Getting started](#getting-started)\n    - [Examples](#examples)\n  - [CoreAPIClient](#coreapiclient)\n    - [Query for objects using CoreSQL](#query-for-objects-using-coresql)\n    - [CRUD object](#crud-object)\n      - [Create a new object](#create-a-new-object)\n      - [Read object by id](#read-object-by-id)\n      - [Update object (providing full new version)](#update-object-providing-full-new-version)\n      - [Update object (providing only fields to change)](#update-object-providing-only-fields-to-change)\n      - [Delete object](#delete-object)\n        - [lastChanged](#lastchanged)\n      - [Batch Actions (Transactions)](#batch-actions-transactions)\n  - [Support](#support)\n  - [License](#license)\n\n\n## Getting started\n\ninstall from NPM\n```bash\nnpm i fsm-sdk --save\n```\n\nusing the sdk in NodeJS with credentials:\n```typescript\nconst fsm = require('fsm-sdk');\n\nconst client = new fsm.CoreAPIClient({\n\n  // [mandatory] your client configuration\n  clientIdentifier: '\u003cyour-clientIdentifier\u003e',\n  clientSecret: '\u003cyour-clientSecret\u003e',\n  clientVersion: '\u003cyour-clientVersion\u003e',\n\n  // [optional] oauth grant type, default=password\n  authGrantType: 'password' | 'client_credentials' | undefined\n\n  // [optional] | [mandatory] if oauth grant type password\n  authAccountName: '\u003cyour-authAccountName\u003e',\n\n  // [optional] | [mandatory] if oauth grant type password\n  authUserName: '\u003cyour-authUserName\u003e',\n\n  // [optional] | [mandatory] if oauth grant type password\n  authPassword: '\u003cyour-authPassword\u003e',\n\n  // [optional] or default=FIRST\n  authCompany: '\u003cyour-authCompany\u003e',\n\n  // [optional] provide verbose logs\n  debug: false,\n\n  // [optional] enable using custom oauth endpoints\n  oauthEndpoint: 'https://eu.fsm.cloud.sap/api/oauth2/v2',\n\n  // [optional] client will cache token (helpful for writing integration tests)\n  tokenCacheFilePath: './.myToken.json'\n\n});\n```\n\nrelated doc's:\n- [Field Service Management - Integration Guidelines](https://help.sap.com/viewer/fsm_integration_guidelines/Cloud/en-US/integration-guidelines-intro.html)\n- [Access API (OAuth 2.0)](https://help.sap.com/viewer/fsm_access_api/Cloud/en-US)\n- [Generating Client ID and Secret](https://help.sap.com/viewer/fsm_admin/Cloud/en-US/generating-client-id.html)\n\n### Examples \nSome illustrative cases are provided in the [examples](./examples) folder.\n\n\n---\n\n## CoreAPIClient\n\nThe CoreAPIClient API actions will return a Promise and is asynchronous by default.\n\n### Query for objects using CoreSQL\n\nProvides the [coreSQL] and the [dtos] used in the query\nsee [Field Service Management - Query API](https://help.sap.com/viewer/fsm_query_api/LATEST/en-US/query-api-intro.html)\n\n```typescript\n\nconst coreSQL =\n  `SELECT\n    sc.id,\n    sc.subject\n  FROM\n    ServiceCall sc\n  WHERE\n   sc.id = '36A5626F65A54FE7911F536C501D151A'\n  `;\n\nawait client.query(coreSQL, ['ServiceCall']);\n```\n\n### CRUD object\n\nrelated doc's:\n- [Data API v4 Docs](https://help.sap.com/viewer/fsm_data_api/Cloud/en-US)\n- [Data Model Documentation](https://help.sap.com/viewer/fsm_data_model/Cloud/en-US/data-model-overview.html)\n\n#### Create a new object\n\n```typescript\nconst serviceCall = {\n   id: fsm.CoreAPIClient.createUUID(), // =\u003e 36A5626F65A54FE7911F536C501D151A\n   ...\n};\n\nawait client.post('ServiceCall', serviceCall);\n```\n\n#### Read object by id or externalId\n\n```typescript\nawait client.getById('ServiceCall', '36A5626F65A54FE7911F536C501D151A');\n// or\nawait client.getByExternalId('ServiceCall', 'my-1');\n```\n\n#### Update object (providing full new version)\n\n```typescript\nawait client.put('ServiceCall', { ... });\n// or\nawait client.putByExternalId('ServiceCall', { ... });\n```\n\n#### Update object (providing only fields to change)\n\n```typescript\nawait client.patch('ServiceCall', {\n    id: '36A5626F65A54FE7911F536C501D151A',\n    subject: 'update-only-subject',\n    lastChanged: 1535712340\n  });\n// or\nawait client.patchByExternalId('ServiceCall', { externalId: 'my-1', ... });\n```\n\n#### Delete object by id or externalId\n\n```typescript\nawait client.deleteById('ServiceCall', {\n    id: '36A5626F65A54FE7911F536C501D151A',\n    lastChanged: 1535712340\n  });\n// or\nawait client.deleteByExternalId('ServiceCall', { externalId: 'my-1', ... });\n```\n\n##### lastChanged\n\nThe `lastChanged` field is used for optimistic locking.\nIt's like a version-key you must provide in order to update an object.\n\n#### Batch Actions (Transactions)\n\n```typescript\n// actions will be executed in sequence order like in array\n\nconst actions = [ \n  new CreateAction('ServiceCall', { ... }), \n  new UpdateAction('BusinessPartner', { id, lastChanged ... }), // required for update\n  new DeleteAction('Address', { id, lastChanged ... }) // required for delete\n];\n\nconst response = await client.batch(actions) \n// response =\u003e [ { body: { statusCode: 200|201|400, data: { ... } } }, req1, req2 ]\n\n// data will contain a list resp, unwrap to access first\nconst [[{ serviceCall }], [{ businessPartner }], ] = response.map(it =\u003e it.body.data);\n```\n\n\n## Support\n\nIn case you need further help, check out the [SAP Field Service Management Help Portal](https://help.sap.com/viewer/product/SAP_FIELD_SERVICE_MANAGEMENT/Cloud/en-US/) or report and incident in [SAP Support Portal](https://support.sap.com) with the component \"CEC-SRV-FSM\".\n\n\n## License\n\nCopyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved.\nThis file is licensed under the Apache Software License, v. 2 except as noted otherwise in the [LICENSE](./LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsap%2Ffsm-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsap%2Ffsm-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsap%2Ffsm-sdk/lists"}