Merge pull request #562 from alphagov/standardise-coding-examples

Docs: tidy up indentation in JSON examples
This commit is contained in:
minglis
2016-05-13 09:00:32 +01:00

View File

@@ -58,8 +58,8 @@ There are 2 ways to integrate the API into your service:
* use one of the client libraries provided by GOV.UK Notify (see the Usage section in the Readme files): * use one of the client libraries provided by GOV.UK Notify (see the Usage section in the Readme files):
* [Python library](https://github.com/alphagov/notifications-python-client) * [Python library](https://github.com/alphagov/notifications-python-client)
* [PHP library] (https://github.com/alphagov/notifications-php-client) * [PHP library](https://github.com/alphagov/notifications-php-client)
* [Java library] (https://github.com/alphagov/notifications-java-client) * [Java library](https://github.com/alphagov/notifications-java-client)
* develop your own integration to produce requests in the correct format * develop your own integration to produce requests in the correct format
<h3 id="AuthRequests">Authenticate requests</h3> <h3 id="AuthRequests">Authenticate requests</h3>
@@ -169,11 +169,11 @@ where:
The response (status code 201) will be: The response (status code 201) will be:
``` ```
{ {
'data':{ 'data':{
'notification': { 'notification': {
'id':1 'id':1
} }
} }
} }
``` ```
@@ -190,25 +190,28 @@ The response (status code 200) will be:
``` ```
{ {
'notification': 'notification': {
{ 'status': 'delivered',
'status': 'delivered', 'to': '07515 987 456',
'to': '07515 987 456', 'template': {
'template': {'id': '5e427b42-4e98-46f3-a047-32c4a87d26bb', 'id': '5e427b42-4e98-46f3-a047-32c4a87d26bb',
'name': 'First template', 'name': 'First template',
'template_type': 'sms'}, 'template_type': 'sms'
'created_at': '2016-04-26T15:29:36.891512+00:00', },
'updated_at': '2016-04-26T15:29:38.724808+00:00', 'created_at': '2016-04-26T15:29:36.891512+00:00',
'sent_at': '2016-04-26T15:29:37.230976+00:00', 'updated_at': '2016-04-26T15:29:38.724808+00:00',
'job': {'id': 'f9043884-acac-46db-b2ea-f08cd8ec6d67', 'sent_at': '2016-04-26T15:29:37.230976+00:00',
'original_file_name': 'Test run'}, 'job': {
'sent_at': '2016-04-26T15:29:37.230976+00:00', 'id': 'f9043884-acac-46db-b2ea-f08cd8ec6d67',
'id': 'f163deaf-2d3f-4ec6-98fc-f23fa511518f', 'original_file_name': 'Test run'
'content_char_count': 490, },
'service': '5cf87313-fddd-4482-a2ea-48e37320efd1', 'sent_at': '2016-04-26T15:29:37.230976+00:00',
'reference': None, 'id': 'f163deaf-2d3f-4ec6-98fc-f23fa511518f',
'sent_by': 'mmg' 'content_char_count': 490,
} 'service': '5cf87313-fddd-4482-a2ea-48e37320efd1',
'reference': None,
'sent_by': 'mmg'
}
} }
``` ```
See [below](#fieldsforGET) for explanations of the fields. See [below](#fieldsforGET) for explanations of the fields.
@@ -223,47 +226,57 @@ The response (status code 200) will be:
``` ```
{'notifications': {'notifications':
[ { [{
'status': 'delivered', 'status': 'delivered',
'to': '07515 987 456', 'to': '07515 987 456',
'template': {'id': '5e427b42-4e98-46f3-a047-32c4a87d26bb', 'template': {
'name': 'First template', 'id': '5e427b42-4e98-46f3-a047-32c4a87d26bb',
'template_type': 'sms'}, 'name': 'First template',
'job': {'id': '5cc9d7ae-ceb7-4565-8345-4931d71f8c2e', 'template_type': 'sms'
'original_file_name': 'Test run'}, },
'created_at': '2016-04-26T15:30:49.968969+00:00', 'job': {
'updated_at': '2016-04-26T15:30:50.853844+00:00', 'id': '5cc9d7ae-ceb7-4565-8345-4931d71f8c2e',
'sent_at': '2016-04-26T15:30:50.383634+00:00', 'original_file_name': 'Test run'
'id': '04ae9bdc-92aa-4d6c-a0da-48587c03d4c7', },
'content_char_count': 446 'created_at': '2016-04-26T15:30:49.968969+00:00',
'service': '5cf87313-fddd-4482-a2ea-48e37320efd1', 'updated_at': '2016-04-26T15:30:50.853844+00:00',
'reference': None, 'sent_at': '2016-04-26T15:30:50.383634+00:00',
'sent_by': 'mmg' 'id': '04ae9bdc-92aa-4d6c-a0da-48587c03d4c7',
}, 'content_char_count': 446,
{ 'service': '5cf87313-fddd-4482-a2ea-48e37320efd1',
'status': 'delivered', 'reference': None,
'to': '07515 987 456', 'sent_by': 'mmg'
'template': {'id': '5e427b42-4e98-46f3-a047-32c4a87d26bb', },
'name': 'First template', {
'template_type': 'sms'}, 'status': 'delivered',
'job': {'id': 'f9043884-acac-46db-b2ea-f08cd8ec6d67', 'to': '07515 987 456',
'original_file_name': 'Test run'}, 'template': {
'created_at': '2016-04-26T15:29:36.891512+00:00', 'id': '5e427b42-4e98-46f3-a047-32c4a87d26bb',
'updated_at': '2016-04-26T15:29:38.724808+00:00', 'name': 'First template',
'sent_at': '2016-04-26T15:29:37.230976+00:00', 'template_type': 'sms'
'id': 'f163deaf-2d3f-4ec6-98fc-f23fa511518f', },
'content_char_count': 490, 'job': {
'service': '5cf87313-fddd-4482-a2ea-48e37320efd1', 'id': 'f9043884-acac-46db-b2ea-f08cd8ec6d67',
'reference': None, 'original_file_name': 'Test run'
'sent_by': 'mmg' },
}, 'created_at': '2016-04-26T15:29:36.891512+00:00',
... 'updated_at': '2016-04-26T15:29:38.724808+00:00',
] 'sent_at': '2016-04-26T15:29:37.230976+00:00',
'links': {'last': '/notifications?page=3&template_type=sms&status=delivered', 'id': 'f163deaf-2d3f-4ec6-98fc-f23fa511518f',
'next': '/notifications?page=2&template_type=sms&status=delivered'}, 'content_char_count': 490,
'total': 162, 'service': '5cf87313-fddd-4482-a2ea-48e37320efd1',
'page_size': 50 'reference': None,
} 'sent_by': 'mmg'
},
],
'links': {
'last': '/notifications?page=3&template_type=sms&status=delivered',
'next': '/notifications?page=2&template_type=sms&status=delivered'
},
'total': 162,
'page_size': 50
}
``` ```
<a name="fieldsforGET"></a> <a name="fieldsforGET"></a>
where: where:
@@ -326,9 +339,3 @@ Error code | Body | Meaning
The GOV.UK Notify API code is open sourced at: The GOV.UK Notify API code is open sourced at:
[GOV.UK Notify API](https://github.com/alphagov/notifications-api) [GOV.UK Notify API](https://github.com/alphagov/notifications-api)