Creating a User with API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chags
    Junior Member
    • Sep 2022
    • 2

    Creating a User with API

    I need to create a user with API​
  • Kharg
    Senior Member
    • Jun 2021
    • 410

    #2
    Just check how it is done from the request tab in your browser, you have to make a post request to user api

    Example
    Code:
    fetch("http://mycrm.com/espocrm/api/v1/User", {
      "headers": {
        "accept": "application/json, text/javascript, */*; q=0.01",
        "accept-language": "en-US;q=0.8,en;q=0.7",
        "content-type": "application/json",
        "espo-authorization-by-token": "true",
        "x-requested-with": "XMLHttpRequest"
      },
      "referrer": "http://mycrm.com/espocrm/",
      "referrerPolicy": "strict-origin-when-cross-origin",
      "body": "{\"type\":\"regular\",\"isActive\":true,\"teams\":{\"teamsIds\":[]},\"userName\":\"test\",\"salutationName\":null,\"firstName\":\"firstName\",\"lastName\":\"LastName\",\"name\":\"firstName LastName\",\"title\":null,\"emailAddressData\":[{\"emailAddress\":\"test@testmail.com\",\"primary\":true,\"optOut\":false,\"invalid\":false,\"lower\":\"test@testmail.com\"}],\"emailAddress\":\"test@testmail.com\",\"emailAddressIsOptedOut\":false,\"gender\":\"Male\",\"defaultTeamName\":null,\"defaultTeamId\":null,\"rolesIds\":[],\"rolesNames\":{},\"passwordInfo\":null,\"phoneNumberData\":[],\"phoneNumber\":null,\"phoneNumberIsOptedOut\":null,\"password\":\"123\",\"passwordConfirm\":\"123\",\"teamsIds\":[],\"teamsNames\":{},\"teamsColumns\":{},\"sendAccessInfo\":true,\"passwordPreview\":\"\"}",
      "method": "POST",
      "mode": "cors",
      "credentials": "include"
    });​

    Comment

Working...