Creating HyperPortal user via API
Introduction
This manual covers the use case of user creation via HyperPortal API.
Prerequisites
Enabled API key for tenant
Go to Api Key settings directly and toggle API key, if not enabled, or
- Press on the avatar to open menu
- Go to Settings
- Go to API Key tab
- Generate new or use existing API key, сheck that the key is enabled (toggle near show key button)
Create permission for contact definition
Go to Contact metadata and confirm that permissions have enabled create permission for HyperPortal integrations under custom groups.
- Go to CMS module
- Go to metadata settings of contact person entity
- Add or update HyperPortal integrations create permission. Create must be enabled.
- Save changes
Write permissions for specific properties
Go to Contact definition and confirm that at least required properties have enabled write permissions for HyperPortal integrations under custom groups.
Required properties on daf-demo (relevant for 08.06.23):
- Email (work)
- First name
Also, you must enable write permissions for every property that you want to be filled through an API. (groups, domains, etc.)
- Go to the CMS module
- Open definition settings
- Go to properties
- Select desired property to modify
- Go to permissions
- Add or update HyperPortal Integrations write permission under custom groups
- Save changes
List of desired groups
Go to groups management page, select entityId of desired groups for new user, you will use list of entityId on the user creation API request under groups property. Check if the group has all necessary permissions.
- Click on the CRM module
- Select Groups
- Select desired group
- Expand system properties section
- Check permissions of the group, if necessary
- Copy entityId of the group. It will be used in the array of the groups for a new user
API request for user creation
General information
You can use integration API to create users.
The JSON body of the request must contain an object with propertyId as keys and desired data in the property as value.
Request must contains at least two headers
- X-tenant-id, for example, daf-demo
- X-api-key, api key from api key settings tab, for daf-demo api key is MGdFAnAb7S2O5guDuFZGF9nqABzE3f4g8JIS2LaX
More details on our swagger
cURL example
curl --location 'https://daf-demo.hyperportal.org/v2-integrations/definitions/contact' \
--header 'x-tenant-id: daf-demo' \
--header 'x-api-key: MGdFAnAb7S2O5guDuFZGF9nqABzE3f4g8JIS2LaX' \
--header 'Content-Type: application/json' \
--data-raw '{
"firstName": "Test",
"emailWork": "[email protected]",
"groups": ["hyperUsers"]
}'
Postman collection example