User, permissions, and API authentication¶
After the installation of the Twingle API extension, various configuration steps must be carried out so that the connection functions smoothly. Among other things, certain configurations must be made on the CMS platform CiviCRM is implemented on.
Connecting to the Twingle API via CiviCRM's REST interface requires a user with appropriate permissions in your CMS-system.
You might want to create a specific user role to assign permissions necessary for calling the Twingle API only. This section describes how to accomplish this in Drupal and Wordpress:
New User Role in Drupal¶
- In Drupal, go to Administration/People/Permissions/Roles.
- Type Twingle API in the text box and select Add role. To the right of your role there will be a edit role function and an edit permissions button. The edit permissions selection will show only the permission selections for the individual role.
- As Permission you only have to select the following entry: Twingle API: Access Twingle API.
New User Role in Wordpress¶
- In CiviCRM, go to Administer/User and Permissions (Access Control).
- Then select the WordPress Access Control link. Here you can adjust the CiviCRM settings for each of the predefined User Roles from WordPress.
- Scroll down. As Permission you only have to select the following entry: * Twingle API: Access Twingle API*.
New User in Drupal¶
- In Drupal, go to Administration/People.
- Then select Add user.
- In user name field enter something like Twingle API
- In Roles select Twingle API.
Take over user¶
The Twingle API only works correctly if a contact connected to the permissioned user exists in CiviCRM.
Here, the corresponding steps are described by way of example when using Drupal.
- In CiviCRM, go to Administer.
- In the Users and Permissions section, choose Synchronize Users to Contacts.
This function checks each user record in Drupal for a contact record in CiviCRM. If there is no corresponding contact record for a user, a new one will be generated. Check this in your CiviCRM contact management.
Assign API key for the Twingle API user¶
The Twingle API contact in CiviCRM needs their own API key for authenticating against CiviCRM's REST API endpoint. The API key is assigned with the help of the API Explorer in CiviCRM.
- Select the Twingle API contact in CiviCRM.
- Look for the corresponding CiviCRM ID and remember the ID.
- Go to Support/Developper/API Explorer v4.
- Enter Contact in the entity field, create in action field and the ID of the Twingle User in the index field.
- In the values field, select api_key.
- Enter the API key for the Twingle API user in the add value field.
- Click on Execute.
Note
You can also create API keys for contacts by using the API Key extension or with administrator tools like cv or drush.