Follow

How to create a new user via API?

Time to read: 3 min

topic.pngThe article covers the following topics:

General Info

First of all, to get started with API, you need to find your API-key. To do it, just navigate to the 'Users' Tab - > 'Users management' -> 'User edit page'. 

Screenshot_36.png

 import.png Only the General manager has permission to get the 'User edit page'.

 click__1_.pngFind out more about How to Create New User here, and How to Grant Specific Permissions to the General Manager here, to the Affiliate Manager here and to the Account Manager here.

Next thing you need is API URL, you can find it in 'Settings' Tab -> 'Settings' -> 'Tracking domains' -> 'URLs' section.

Markup 2020-07-22 at 13.29.20.png

click__1_.pngFind out more about where you can find your/Affiliate's API-key and API URL here

API Request Structure: GET/POST + api domain + path + ? + api-key=189471975956279174174.

It should be noted that header content-type - application/x-www-form-urlencoded is used on an ongoing basis, and content-type - multipart/form-data is used for uploading files (logo, creative files). 

[POST] Add user

To create a new user via API, you need to navigate to the 'User managing (admin methods)' section in the API Doc and choose the 'Add user' method (follow the link):

_______2020_07_22_12_00_04_242.gif

Here you may see a lot of parameters that can be used to create a new user. 

These parameters are required:

  • email - [REQUIRED] User's Email
  • password - [REQUIRED] User's password (Available: at least 6 characters)
  • first_name - [REQUIRED] User's first name
  • last_name - [REQUIRED] User's last name
  • roles[] - [REQUIRED] Array of allowed roles.

The required parameter 'roles[]' includes one of the user types: General manager / Affiliate manager / Sales manager, and may includes section visibility. Some roles include others, e.g: 

ROLE_MANAGER_AFFILIATE => 
'ROLE_SECTION_STATS'
'ROLE_SECTION_STATS' => 
'ROLE_SECTION_STATS_COMMON',
'ROLE_SECTION_STATS_CONVERSION',
'ROLE_SECTION_STATS_SUPPLIER',
'ROLE_SECTION_STATS_OFFER',
'ROLE_SECTION_STATS_PARTNER',
'ROLE_SECTION_STATS_COUNTRY',
'ROLE_SECTION_STATS_CITY',
'ROLE_SECTION_STATS_OS',
'ROLE_SECTION_STATS_GOAL',
'ROLE_SECTION_STATS_DEVICE',
'ROLE_SECTION_STATS_LIMITS',
'ROLE_SECTION_STATS_PARTNER_POSTBACK',
'ROLE_SECTION_STATS_SERVER_POSTBACK',
'ROLE_SECTION_STATS_COMPARISON'

Below you can find an example on how to create a new user via API:

1) First of all, make sure that headers are entered correctly: 

Screenshot_198.png

2) Enter the required and all needed parameters in the body section: 

Screenshot_199.png

If everything is entered correctly, you will receive the status '1' response.

cURL Request

The example of user creation via cURL request:

curl --location --request POST 'http://api.affise.com/3.0/admin/user' \
--header 'api-key: c057faba8779ef56bdc493' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'email=api_user@gmail.com' \
--data-urlencode 'password=88888888' \
--data-urlencode 'first_name=Api' \
--data-urlencode 'last_name=User' \
--data-urlencode 'roles[0]=ROLE_MANAGER_AFFILIATE' \
--data-urlencode 'roles[1]=ROLE_SECTION_SUPPLIER' \
--data-urlencode 'roles[2]=ROLE_SECTION_PARTNER' \
--data-urlencode 'skype=api_user' \
--data-urlencode 'work_hours=8-8'

article.pngYou may also find the following articles helpful:

 If you have more questions on how to create a new user via API, feel free to contact the Affise Support Team via support@affise.com or your Dedicated Account Manager.

 Written by Anastasia Deryugina 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.