Announcement

Collapse
No announcement yet.

API for Administrative tasks

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • API for Administrative tasks

    I am looking for documentation for performing administrative tasks and not just CRUD operations on existing entities. This documentation https://www.espocrm.com/documentation/development/api/ is does not include endpoints for admin functions.

    I was able to scrape the browser request to find the following on my test server, which creates an entity type.
    curl 'http://test.avid24.net/api/v1/EntityManager/action/createEntity' -H 'Cookie: auth-token-secret=xxxxxxxxx; auth-username=admin; auth-token=xxxxxxxxxx' -H 'Origin: http://test.avid24.net' -H 'Espo-Authorization-By-Token: true' -H 'Accept-Language: en-US,en;q=0.9' -H 'Authorization: Basic YWRtaW46NWEzNGU0MTQxOWFjZDc5YzMxMmRmZGQ0MDAyNTA5ZD I=' -H 'Accept-Encoding: gzip, deflate' -H 'Connection: keep-alive' -H 'Espo-Authorization: xxxxxxxxxx' -H 'X-Requested-With: XMLHttpRequest' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36' -H 'Content-Type: application/json' -H 'Pragma: no-cache' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Referer: http://test.avid24.net/' -H 'DNT: 1' --data-binary '{"name":"Test","labelSingular":"Test","labelPlura l":"Tests","type":"BasePlus","stream":true,"disabl ed":false,"iconClass":"fas fa-apple-alt","color":null}' --compressed

    So to create an entity type, POST data to EntityManager/action/createEntity.

    Also, while looking at the permissions that can be granted to an api user, I didn't see anything that grants admin access to be able to create entity types or other admin/setup tasks. Is it safe to assume that this has to be an "admin" user?

    Please help.

  • #2
    Whole GUI is based on API, so everything what you can do from EspoCRM web giu, you can do from API.
    About permissions for api. Create role with admin rights. After that try to assign api user to that role.

    Comment


    • #3
      thanks emillod . Yep. While waiting, I ended up doing more of what I mentioned in the question. I performed the UI action and scraped the network requests to get all the endpoints I needed. I have a path forward.

      Comment

      Working...
      X