CMDBUILD 3 REST API EXAMPLE AUTHENTICATION

Geez, how hard is it to slap an example in the documentation, Tecnoteca?

here, guys i know you’ve been looking hard for this and here you go:

curl -X POST '//10.0.0.26:8080/services/rest/v3/sessions/?scope=service' --header 'Content-Type: application/json' --data-binary '{"username": "admin", "password": "admin"}' | jq '.'

you should get in reply:

{
  "success": true,
  "data": {
    "_id": "jnewhluqn7iconbxf39107ss",
    "username": "admin",
    "userDescription": "Administrator",
    "role": "SuperUser",
    "availableRoles": [
      "SuperUser"
    ],
    "multigroup": false,
    "rolePrivileges": {
      "admin_all": true,
      "admin_all_readonly": true,
      "base_all": true,
      "impersonate_all": true,
      "base_access": true,
      "admin_access": true,
      "system_access": true,
      "data_all_read": true,
      "data_all_write": true,
      "process_all_exec": true,
      "data_all_tenant": true,
      "bulkupdate_access": true,
      "changepassword_access": true,
      "class_access": true,
      "custompages_access": true,
      "dashboard_access": true,
      "dataview_access": true,
      "exportcsv_access": true,
      "importcsv_access": true,
      "process_access": true,
      "report_access": true,
      "card_tab_attachment_access": true,
      "card_tab_detail_access": true,
      "card_tab_email_access": true,
      "card_tab_history_access": true,
      "card_tab_note_access": true,
      "card_tab_relation_access": true,
      "flow_tab_attachment_access": true,
      "flow_tab_detail_access": true,
      "flow_tab_email_access": true,
      "flow_tab_history_access": true,
      "flow_tab_note_access": true,
      "flow_tab_relation_access": true,
      "admin_classes_view": true,
      "admin_classes_modify": true,
      "admin_processes_view": true,
      "admin_processes_modify": true,
      "admin_domains_view": true,
      "admin_domains_modify": true,
      "admin_lookups_view": true,
      "admin_lookups_modify": true,
      "admin_views_view": true,
      "admin_views_modify": true,
      "admin_dashboards_view": true,
      "admin_dashboards_modify": true,
      "admin_reports_view": true,
      "admin_reports_modify": true,
      "admin_menus_view": true,
      "admin_menus_modify": true,
      "admin_navtrees_view": true,
      "admin_navtrees_modify": true,
      "admin_roles_view": true,
      "admin_roles_modify": true,
      "admin_users_view": true,
      "admin_users_modify": true,
      "admin_jobs_view": true,
      "admin_jobs_modify": true,
      "admin_email_view": true,
      "admin_email_modify": true,
      "admin_gis_view": true,
      "admin_gis_modify": true,
      "admin_bim_view": true,
      "admin_bim_modify": true,
      "admin_localization_view": true,
      "admin_localization_modify": true,
      "admin_sysconfig_view": true,
      "admin_sysconfig_modify": true
    },
    "beginDate": "2019-09-05T14:56:10.13Z",
    "lastActive": "2019-09-05T14:56:10.13Z"
  }
}
response:
< HTTP/1.1 200
< CMDBuild-RequestId: mdkl781cg4cn2xcx480n84iu
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: SAMEORIGIN
< Date: Thu, 05 Sep 2019 14:58:59 GMT
< Content-Type: application/json
< Content-Length: 2016

Subsequent request will have to use the value of _id for the next call.

For instance:

curl -v GET '//10.0.0.26:8080/services/rest/v3/classes?scope=service' --header 'Content-Type: application/json' --header 'Cmdbuild-authorization:137aztpq3yzymsu6og65v290' 

I hope this salve some headache around. Though i still have to figure which is the authentication token. To all the ones who will whine that this is in the documentation, i reply, it’s not indexed by search engines, so it’s very hard to find.

 
(Visited 12 times, 1 visits today)

Author: Giuseppe Urso

Giuseppe lives in Haarlem now with his shiny dog, Filippa In 1982 received his first home computer, a Commodore 64, followed by Datasette and a 1541 Floppy Disk Drive. In 1999 he installed his first Linux distro (LRH6). In 2006 he switched to Debian as favourite OS. Giuseppe Urso actively sustains the Free Software Fundation and his founder Richard Mattew Stallman, he speaks to people trying to convince them to join the fight now, and about how important is to use Free Software only. He has a job as Infra Specialist at Hippo Enterprise Java Cms an Open Source Enterprise class Content Management System, one of the coolest company ever, in Amsterdam. He's always ready to install Debian on other people computers for free.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.