Skip to content

Commit 5dd9272

Browse files
authored
Merge pull request #285 from mkistler/minor-fixes
Clarify error response structure and casing for acronyms
2 parents c737442 + c1b228f commit 5dd9272

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

azure/Guidelines.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ Method | Description | Response Status Code
127127
PATCH | Create/Modify the resource with JSON Merge Patch | `200-OK`, `201-Created`
128128
PUT | Create/Replace the _whole_ resource | `200-OK`, `201-Created`
129129
POST | Create new resource (ID set by service) | `201-Created` with URL of created resource
130+
POST | Action | `200-OK`, `204-No Content` (only when nothing returned in response body)
130131
GET | Read (i.e. list) a resource collection | `200-OK`
131132
GET | Read the resource | `200-OK`
132133
DELETE | Remove the resource | `204-No Content`\; avoid `404-Not Found`
@@ -238,7 +239,7 @@ Because of this, required fields can only be introduced in the 1st version of a
238239

239240
:white_check_mark: **DO** make fields simple and maintain a shallow hierarchy.
240241

241-
:white_check_mark: **DO** use camel case for all JSON field names.
242+
:white_check_mark: **DO** use camel case for all JSON field names. Do not upper-case acronyms; use camel case.
242243

243244
:white_check_mark: **DO** treat JSON field names with case-sensitivity.
244245

@@ -282,17 +283,42 @@ There are 2 kinds of errors:
282283
- An error where you expect customer code to gracefully recover at runtime
283284
- An error indicating a bug in customer code that is unlikely to be recoverable at runtime; the customer must just fix their code
284285

285-
:white_check_mark: **DO** return error an `x-ms-error-code` response header with a string value indicating what went wrong.
286+
:white_check_mark: **DO** return an `x-ms-error-code` response header with a string error code indicating what went wrong.
286287

287288
*NOTE: Error code values are part of your API contract (because customer code is likely to do comparisons against them) and cannot change in the future.*
288289

289290
:white_check_mark: **DO** carefully craft `x-ms-error-code` string values for errors that are recoverable at runtime.
290291

291-
:white_check_mark: **DO** ensure that the top-level `code` field's value is identical to the `x-ms-error-code` header's value (see example body below).
292+
:white_check_mark: **DO** ensure that the top-level `code` field's value is identical to the `x-ms-error-code` header's value.
292293

293294
:white_check_mark: **DO** document the service's error code strings; they are part of the API contract.
294295

295-
:white_check_mark: **DO** provide a response body as follows (example):
296+
:white_check_mark: **DO** provide a response body with the following structure:
297+
298+
**ErrorResponse** : Object
299+
300+
Property | Type | Required | Description
301+
-------- | ---- | :------: | -----------
302+
`error` | ErrorDetail | ✔ | The error object.
303+
304+
**ErrorDetail** : Object
305+
306+
Property | Type | Required | Description
307+
-------- | ---- | :------: | -----------
308+
`code` | String | ✔ | One of a server-defined set of error codes.
309+
`message` | String | ✔ | A human-readable representation of the error.
310+
`target` | String | | The target of the error.
311+
`details` | ErrorDetail[] | | An array of details about specific errors that led to this reported error.
312+
`innererror` | InnerError | | An object containing more specific information than the current object about the error.
313+
314+
**InnerError** : Object
315+
316+
Property | Type | Required | Description
317+
-------- | ---- | :------: | -----------
318+
`code` | String | | A more specific error code than was provided by the containing error.
319+
`innererror` | InnerError | | An object containing more specific information than the current object about the error.
320+
321+
Example:
296322
```json
297323
{
298324
"error": {

0 commit comments

Comments
 (0)