Comment 1 for bug 1674347

Revision history for this message
Jim Baker (jimbaker) wrote :

Need to address duplicate user creation in a given project, so returns 409 instead of 500. However same user name in different projects is allowed (but not yet tested).

$ craton-post v1/projects name=baz
HTTP/1.0 201 CREATED
Content-Length: 155
Content-Type: application/json
Date: Tue, 21 Mar 2017 15:34:24 GMT
Location: http://127.0.0.1:7780/v1/projects/289b9377-8470-43e2-bc45-04f730ddc248
Server: WSGIServer/0.2 CPython/3.5.2
x-openstack-request-id: req-535dcb02-5687-40a2-98f1-bd6549f9151a

{
    "created_at": "2017-03-21T15:34:24.824411",
    "id": "289b9377-8470-43e2-bc45-04f730ddc248",
    "name": "baz",
    "updated_at": null,
    "variables": {}
}

$ craton-post v1/users username=bar project_id=289b9377-8470-43e2-bc45-04f730ddc248
HTTP/1.0 201 CREATED
Content-Length: 248
Content-Type: application/json
Date: Tue, 21 Mar 2017 15:34:45 GMT
Location: http://127.0.0.1:7780/v1/users/4
Server: WSGIServer/0.2 CPython/3.5.2
x-openstack-request-id: req-68ebb2db-6c95-4ed9-8970-0655cf195d77

{
    "api_key": "fba5c972-2d81-43e7-890c-bea823d74b1b",
    "created_at": "2017-03-21T15:34:45.392952",
    "id": 4,
    "is_admin": false,
    "project_id": "289b9377-8470-43e2-bc45-04f730ddc248",
    "roles": [],
    "updated_at": null,
    "username": "bar"
}

$ craton-post v1/users username=bar project_id=289b9377-8470-43e2-bc45-04f730ddc248
HTTP/1.0 500 INTERNAL SERVER ERROR
Content-Length: 50
Content-Type: text/html; charset=utf-8
Date: Tue, 21 Mar 2017 15:34:51 GMT
Server: WSGIServer/0.2 CPython/3.5.2
x-openstack-request-id: req-9884d8e6-56f5-4a29-9c3d-258e43e93a79

{
    "message": "Unknown Error",
    "status": 500
}