Copyright © Bentley Systems, Incorporated. All rights reserved.
A repository for sample applications which utilise aspects of Bentley's ES-API. This README details processes which are the same among the subprojects.
- ES-API Projects - Demonstrates how to create, query, and delete a Project using the Enterprise Systems Project API, also dealing with billing country endpoints and data center endpoint usage.
- ES-API WorkArea - ProjectWise Web Connections API for mapping Work Area Connections from Project Wise Design Integration to iTwin Projects.
- ES-API 4D Schedules Service - Demonstrates an example workflow of acquiring a Resource Status History item and changing the Date value within said item using the 4D Schedules External API.
- ES-API 4D Schedules SPA - Demonstrates an example workflow of acquiring a Resource Status History item and changing the Date value within said item using the 4D Schedules External API.
- Git
- (For non-web applications) .NET 6.0
- (For web applications) NodeJS and NPM
- Optionally an IDE like Visual Studio 2022 or Visual Studio Code. It is also possible to use command line.
Valid access token with scope 'enterprise' is required to access API endpoints. For more technical information about tokens and authentication see: https://developer.bentley.com/apis/overview/authorization.
In order to run this sample app or if you want to develop your own application you'll have to register a client in https://developer.bentley.com/esregister.
- If you're not logged in, you'll get redirected to a login page once you go to https://developer.bentley.com/esregister. If you don't have one already, create an account and start the trial. Then go back to api client registration page.
- Fill in application name. This is a display name, client id will be generated automatically.
- Check the api client details:
- Make sure
Enterprise
is checked under API associations - Make sure
enterprise
scope is added under Allowed scopes - For web apps, make sure
Allow Offline Access
is checked.
- Make sure
- Select an appropriate application type. If you just want to run the sample app
Service
type will be enough. If you don't know which type to choose for a user-facing application check out https://developer.bentley.com/apis/overview/authorization. - Fill in redirect url if application type is not
Service
. This is the url to your application which authentication service will come back to once user is logged in. - Click
Save
- Make sure to copy client secret and close the dialog.
- A page should appear with created api client. In order to get tokens you'll also need the client id that should be shown in this window.
- You should be able to authenticate now by using client id and secret with the appropriate flow.
curl --request POST \
--url 'https://ims.bentley.com/connect/token' \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode grant_type=client_credentials \
--data-urlencode scope=enterprise \
--data-urlencode client_id=YOUR_CLIENT_ID \
--data-urlencode client_secret=YOUR_CLIENT_SECRET
(Invoke-WebRequest -Method 'Post' `
-Uri 'https://ims.bentley.com/connect/token' `
-Headers @{ 'content-type' = 'application/x-www-form-urlencoded' } `
-Body @{ `
grant_type='client_credentials'; `
scope='enterprise'; `
client_id='YOUR_CLIENT_ID'; `
client_secret='YOUR_CLIENT_SECRET' `
}).Content