From 201b2f1099c6c1a963455d54bacbe473c7e27f95 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Wed, 21 Jan 2015 18:57:54 +0100 Subject: [PATCH 1/2] Add return value example to ssh key creation Signed-off-by: Loic Dachary --- doc/api/users.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/api/users.md b/doc/api/users.md index b30a31deccc..dd158f124de 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -322,6 +322,15 @@ Parameters: - `title` (required) - new SSH Key's title - `key` (required) - new SSH key +```json +{ + "created_at": "2015-01-21T17:44:33.512Z", + "key": "ssh-dss AAAAB3NzaC1kc3MAAACBAMLrhYgI3atfrSD6KDas1b/3n6R/HP+bLaHHX6oh+L1vg31mdUqK0Ac/NjZoQunavoyzqdPYhFz9zzOezCrZKjuJDS3NRK9rspvjgM0xYR4d47oNZbdZbwkI4cTv/gcMlquRy0OvpfIvJtjtaJWMwTLtM5VhRusRuUlpH99UUVeXAAAAFQCVyX+92hBEjInEKL0v13c/egDCTQAAAIEAvFdWGq0ccOPbw4f/F8LpZqvWDydAcpXHV3thwb7WkFfppvm4SZte0zds1FJ+Hr8Xzzc5zMHe6J4Nlay/rP4ewmIW7iFKNBEYb/yWa+ceLrs+TfR672TaAgO6o7iSRofEq5YLdwgrwkMmIawa21FrZ2D9SPao/IwvENzk/xcHu7YAAACAQFXQH6HQnxOrw4dqf0NqeKy1tfIPxYYUZhPJfo9O0AmBW2S36pD2l14kS89fvz6Y1g8gN/FwFnRncMzlLY/hX70FSc/3hKBSbH6C6j8hwlgFKfizav21eS358JJz93leOakJZnGb8XlWvz1UJbwCsnR2VEY8Dz90uIk1l/UqHkA= loic@call", + "title": "ABC", + "id": 4 +} +``` + ## Add SSH key for user Create new key owned by specified user. Available only for admin From d9b946fb3edb3288b6ae39c8882b287639a75cbb Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Wed, 21 Jan 2015 19:08:15 +0100 Subject: [PATCH 2/2] Document ssh key creation error Add the error code returned in the headers as well as an example of the JSON informative message returned in the body. Signed-off-by: Loic Dachary --- doc/api/users.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/api/users.md b/doc/api/users.md index dd158f124de..71fa62bdd65 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -331,6 +331,22 @@ Parameters: } ``` +Will return created key with status `201 Created` on success. If an +error occurs a `400 Bad Request` is returned with a message explaining the error: + +```json +{ + "message": { + "fingerprint": [ + "has already been taken" + ], + "key": [ + "has already been taken" + ] + } +} +``` + ## Add SSH key for user Create new key owned by specified user. Available only for admin