Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This is a separate API from the normal REST API and the base url should be the same as the admin system (i.e. https://adm-us.drofus.com/)  you are trying to access.

E.g. the link http://[admin-url]/projects gives the normal HTML project listing while http://[url]/projects.xml gives the same list in XML format and http://[admin-url]/projects.json gives the list with project and project users in JSON format

...

Code Block
curl -H "Accept: application/json" -s -u testadmin:testpw http://localhost:3000[admin-url]/users/hakonhc

will give the same as 

Code Block
curl -s -u testadmin:testpw http://localhost:3000[admin-url]/users/hakonhc.json

Resources:

...

Code Block
$ curl -s -u testadmin:testpw http://localhost:3000[admin-url]/projects.json?query=template|json_reformat 
[
    {
        "project": {
            "active": true,
            "contact": null,
            "created_at": "2016-11-01T09:39:14Z",
            "created_by": null,
            "database_id": "akl-test",
            "description": null,
            "gross_area": null,
            "id": 399,
            "name": "dRofus dev template",
            "no": "01",
            "owner_id": 5,
            "status": null,
            "updated": null,
            "updated_by": null,
			"unit_type": "SM" #SM for square meters or SF for square feet
        }
    },
.....

...

Code Block
$ curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -u testadmin:testpw -d '{"owner":{"name":"Test"}}' http://localhost:3000[admin-url]/owners


{"owner":{"address":null,"billing_address":null,"contact":null,"id":11,"image":null,"name":"Test","network":null,"note":null,"tech_contact":null}}

...

Code Block
$ curl -H "Accept: application/json" -H "Content-type: application/json; charset=UTF-8" -X POST -u testadmin:testpw -d @data.json http://localhost:3000[admin-url]/project_users

{"project_user":{"created_at":"2016-11-28T12:22:35Z","project_id":408,"role":null,"superuser":null,"user_role_id":null,"username":"hakonhc"}}

...

Code Block
$ curl -H "Accept: application/json" -H "Content-type: application/json; charset=UTF-8" -X PATCH -u testadmin:testpw -d @data.json http://localhost:3000[admin-url]/projects/1

Wherer data.json contains

...

Code Block
$ curl -H "Accept: application/json" -H "Content-type: application/json; charset=UTF-8" -X PATCH -u testadmin:testpw -d @data.json http://localhost:3000[admin-url]/project_user/testuser,1

Wherer data.json contains

...

Code Block
curl -H "Accept: application/json" -s -u http://localhost:3000[admin-url]/project_users/[username],[project_id] -X DELETE

...