0.1.1 • Published 3 years ago

@digitregroup/cornerstone-client v0.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Cornerstone client API

Description

It's an api client to request Cornerstone REST Services and Reporting Services.

  • Documentation apiexplorer.csod.com
  • There are several examples in repository test/
  • Be careful, userid, id and many more have different value in Reporting and REST for the same user and same key

Reporting API

The Reporting API is a public facing web service that allows clients programmatic read-only access to their Cornerstone data via the Realtime Data Warehouse. It adheres to the OData protocol (http://www.odata.org/)

There are some use cases in tests repository.

  • tests/reporting-api.test.js
  • tests/rest-api.test.js

How to use

const params = {
    apiId:          Api Id, can be retrieved within the Manage API tab in Integration Center.
    apiSecret:      Api Secret, can be retrieved within the Manage API tab in Integration Center.
    corpname:       Client assigned hostname for CSOD application
    region:         Aws-region,
    dynamodbName:   Aws dynamodb,
};

const cornerstone = new Cornerstone(params);

const user = await cornerstone.getReportingUserByEmail({email: reporting_user_email});

Queries

URL OptionSyntaxDescription
Get Available Resources{baseURL}/viewsThis call returns a list of available resources (views).
Get Metadata{baseURL}/views/$metadataThis call returns a list of resources and their meta-data. This call returns XML instead of JSON****
Get Specific Resource{baseURL}/views/vw_rpt_userReturns detail payload for specific resource.
Select{baseURL}/views/vw_rpt_user?$select={comma separated field list}Returns detail payload for specific selected fields for resource.
Filter{baseURL}/views/vw_rpt_user?$filter={query filter}Returns specific data as per filter value for resource. Odata standards should be followed for operator types
Top{baseURL}/views/vw_rpt_user?$top={max records}Limits the number of records returned by the query.

Filter Supported Operators

URL OptionSyntax
Equals{baseURL}/views/vw_rpt_user?$filter=user_id eq 78
Not Equals{baseURL}/views/vw_rpt_user?$filter=user_id ne 78
Greater Than{baseURL}/views/vw_rpt_user?$filter=user_lo_last_action_dt gt cast('2016-08-16', Edm.DateTimeOffset)
Greater Than or Equal{baseURL}/views/vw_rpt_user?$filter=user_lo_last_action_dt ge cast('2016-08-16', Edm.DateTimeOffset)
Less Than{baseURL}/views/vw_rpt_user?$filter=user_lo_last_action_dt lt cast('2016-08-16', Edm.DateTimeOffset)
Less Than or Equal{baseURL}/views/vw_rpt_user?$filter=user_lo_last_action_dt le cast('2016-08-16', Edm.DateTimeOffset)
Logical 'AND'{baseURL}/views/vw_rpt_user?$filter=user_lo_last_action_dt le cast('2016-08-16', Edm.DateTimeOffset) and user_id eq 78
Logical 'OR'{baseURL}/views/vw_rpt_user?$filter=user_lo_last_action_dt le cast('2016-08-16', Edm.DateTimeOffset) or user_id eq 78
Logical 'NOT'{baseURL}/views/vw_rpt_user?$filter=not (user_id eq 78)

REST API

The REST API allows programmatic access to the REST record within the Cornerstone application. This service enables clients to create, update, and read REST data.

How to use

const params = {
apiId:     Api Id, can be retrieved within the Manage API tab in Integration Center.
apiSecret: Api Secret, can be retrieved within the Manage API tab in Integration Center.
username: A valid username in the portal.
alias: An arbitrary title for your session.
corpname: Client assigned hostname for CSOD application
};

const cornerstone = new Cornerstone(params);

const user = await cornerstone.updateEmployeeByUserId({
    id: rest_id,
    data: {"personalEmail": rest_email}
});

const user = await cornerstone.getEmployeeByUserId({userId: rest_userId});

Set Active or inactive

const user = await cornerstone.updateEmployeeByUserId({
    id:   2328,
    data : {"workerStatus":{active: true}}
});

active = user_status_id = 1 inActive = user_status_id = 2

0.1.1

3 years ago

0.1.0

3 years ago

0.0.67

3 years ago

0.0.68

3 years ago

0.0.66

3 years ago

0.0.65

3 years ago

0.0.63

4 years ago

0.0.64

4 years ago

0.0.62

4 years ago

0.0.61

4 years ago

0.0.60

4 years ago

0.0.59

4 years ago

0.0.58

5 years ago

0.0.57

5 years ago

0.0.56

5 years ago

0.0.55

5 years ago

0.0.54

5 years ago

0.0.53

5 years ago

0.0.52

5 years ago

0.0.50

5 years ago

0.0.49

5 years ago

0.0.48

5 years ago

0.0.46

5 years ago

0.0.42

5 years ago

0.0.41

5 years ago

0.0.3

5 years ago

0.0.1

5 years ago