1.0.2 • Published 3 years ago

procore v1.0.2

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

How to Setup and Use the ProcoreClient

To install the SDK, make sure you are in the Crimer organization on npm:

npm install procore

To use the SDK, import the procore client with:

import ProcoreClient from 'procore';

And instantiate an instance of ProcoreClient using the access token and refresh token from Procore:

const procoreInstance = new ProcoreClient({
  clientId: 'a;slkfjsa;dlfkjas;dlfjas;lfakjsd;lkjsa;flkjdsf;lkj',
  clientSecret: 'as;flkjsad;flkjsadf;lksajf;salkfdj',
  accessToken:
    'Bearer asdfj;lsajf;lsajfa;sjfds;ljfsajfasdlkfjasdlfjasd;lf',
  refreshToken: 'asdflkjsa;lfkjsd;flkjsa;flkajsdf;lkj',
  redirectURL: 'http://crimer.com/',
  stage: 'dev', // either dev or production (will change what URLs are used for the requests)
});

To run the procore-client-example, open a terminal and make the typescript compiler watch the files with:

tsc -w

Then open a new terminal, make sure your access/refresh token are updated and run:

node procore-client-example.js

The various methods of the SDK always return either an object or an array of objects (for calls such as listRFIs). In the case of an object, you can usually just access fields by using result.examplefield. In the case of an array of objects, you'll need to loop through the fields.


The ProcoreClient itself can also be modified if needed. API responses can be modified by first changing the interface of the response at the top of the ProcoreClient.ts file and then making sure the returned object/array object maps the API response to the interface properly.


Documentation for the API endpoints can be found here. Make sure to use rest v1 and not the deprecated Vapid endpoints.

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago