23 changed files with 266 additions and 0 deletions
@ -0,0 +1 @@ |
|||||
|
partnerapi.html |
@ -0,0 +1,11 @@ |
|||||
|
[source,bash] |
||||
|
---- |
||||
|
$ curl 'http://localhost:8080/partner' -i -X POST \ |
||||
|
-H 'Content-Type: application/json' \ |
||||
|
-d '{ |
||||
|
"reference" : "FYI25", |
||||
|
"expirationTime" : "2013-10-03T12:18:46+01:00", |
||||
|
"name" : "UPS", |
||||
|
"locale" : "en_BE" |
||||
|
}' |
||||
|
---- |
@ -0,0 +1,14 @@ |
|||||
|
[source,http,options="nowrap"] |
||||
|
---- |
||||
|
POST /partner HTTP/1.1 |
||||
|
Content-Type: application/json |
||||
|
Content-Length: 117 |
||||
|
Host: localhost:8080 |
||||
|
|
||||
|
{ |
||||
|
"reference" : "FYI25", |
||||
|
"expirationTime" : "2013-10-03T12:18:46+01:00", |
||||
|
"name" : "UPS", |
||||
|
"locale" : "en_BE" |
||||
|
} |
||||
|
---- |
@ -0,0 +1,14 @@ |
|||||
|
[source,http,options="nowrap"] |
||||
|
---- |
||||
|
HTTP/1.1 201 Created |
||||
|
Content-Type: application/json |
||||
|
Content-Length: 130 |
||||
|
|
||||
|
{ |
||||
|
"id" : 13, |
||||
|
"name" : "UPS", |
||||
|
"reference" : "FYI25", |
||||
|
"locale" : "en_BE", |
||||
|
"expirationTime" : "2013-10-03T12:18:46+01:00" |
||||
|
} |
||||
|
---- |
@ -0,0 +1,10 @@ |
|||||
|
[source,bash] |
||||
|
---- |
||||
|
$ echo '{ |
||||
|
"reference" : "FYI25", |
||||
|
"expirationTime" : "2013-10-03T12:18:46+01:00", |
||||
|
"name" : "UPS", |
||||
|
"locale" : "en_BE" |
||||
|
}' | http POST 'http://localhost:8080/partner' \ |
||||
|
'Content-Type:application/json' |
||||
|
---- |
@ -0,0 +1,9 @@ |
|||||
|
[source,options="nowrap"] |
||||
|
---- |
||||
|
{ |
||||
|
"reference" : "FYI25", |
||||
|
"expirationTime" : "2013-10-03T12:18:46+01:00", |
||||
|
"name" : "UPS", |
||||
|
"locale" : "en_BE" |
||||
|
} |
||||
|
---- |
@ -0,0 +1,20 @@ |
|||||
|
|=== |
||||
|
|Path|Type|Description |
||||
|
|
||||
|
|`+name+` |
||||
|
|`+String+` |
||||
|
|The name of the partner |
||||
|
|
||||
|
|`+reference+` |
||||
|
|`+String+` |
||||
|
|The unique reference of the partner |
||||
|
|
||||
|
|`+locale+` |
||||
|
|`+String+` |
||||
|
|A valid Locale of the partner |
||||
|
|
||||
|
|`+expirationTime+` |
||||
|
|`+String+` |
||||
|
|The ISO-8601 UTC date time when the partner is going to expire |
||||
|
|
||||
|
|=== |
@ -0,0 +1,10 @@ |
|||||
|
[source,options="nowrap"] |
||||
|
---- |
||||
|
{ |
||||
|
"id" : 13, |
||||
|
"name" : "UPS", |
||||
|
"reference" : "FYI25", |
||||
|
"locale" : "en_BE", |
||||
|
"expirationTime" : "2013-10-03T12:18:46+01:00" |
||||
|
} |
||||
|
---- |
@ -0,0 +1,4 @@ |
|||||
|
[source,bash] |
||||
|
---- |
||||
|
$ curl 'http://localhost:8080/partner/1' -i -X GET |
||||
|
---- |
@ -0,0 +1,6 @@ |
|||||
|
[source,http,options="nowrap"] |
||||
|
---- |
||||
|
GET /partner/1 HTTP/1.1 |
||||
|
Host: localhost:8080 |
||||
|
|
||||
|
---- |
@ -0,0 +1,14 @@ |
|||||
|
[source,http,options="nowrap"] |
||||
|
---- |
||||
|
HTTP/1.1 200 OK |
||||
|
Content-Type: application/json |
||||
|
Content-Length: 129 |
||||
|
|
||||
|
{ |
||||
|
"id" : 1, |
||||
|
"name" : "B2boost", |
||||
|
"reference" : "FYI1", |
||||
|
"locale" : "en_BE", |
||||
|
"expirationTime" : "2022-11-24 17:46:00+01" |
||||
|
} |
||||
|
---- |
@ -0,0 +1,4 @@ |
|||||
|
[source,bash] |
||||
|
---- |
||||
|
$ http GET 'http://localhost:8080/partner/1' |
||||
|
---- |
@ -0,0 +1,8 @@ |
|||||
|
.+/partner/{id}+ |
||||
|
|=== |
||||
|
|Parameter|Description |
||||
|
|
||||
|
|`+id+` |
||||
|
|id of partner to be searched |
||||
|
|
||||
|
|=== |
@ -0,0 +1,4 @@ |
|||||
|
[source,options="nowrap"] |
||||
|
---- |
||||
|
|
||||
|
---- |
@ -0,0 +1,10 @@ |
|||||
|
[source,options="nowrap"] |
||||
|
---- |
||||
|
{ |
||||
|
"id" : 1, |
||||
|
"name" : "B2boost", |
||||
|
"reference" : "FYI1", |
||||
|
"locale" : "en_BE", |
||||
|
"expirationTime" : "2022-11-24 17:46:00+01" |
||||
|
} |
||||
|
---- |
@ -0,0 +1,24 @@ |
|||||
|
|=== |
||||
|
|Path|Type|Description |
||||
|
|
||||
|
|`+id+` |
||||
|
|`+Number+` |
||||
|
|The id of the partner |
||||
|
|
||||
|
|`+name+` |
||||
|
|`+String+` |
||||
|
|The name of the partner |
||||
|
|
||||
|
|`+reference+` |
||||
|
|`+String+` |
||||
|
|The unique reference of the partner |
||||
|
|
||||
|
|`+locale+` |
||||
|
|`+String+` |
||||
|
|A valid Locale of the partner |
||||
|
|
||||
|
|`+expirationTime+` |
||||
|
|`+String+` |
||||
|
|The ISO-8601 UTC date time when the partner is going to expire |
||||
|
|
||||
|
|=== |
@ -0,0 +1,4 @@ |
|||||
|
[source,bash] |
||||
|
---- |
||||
|
$ curl 'http://localhost:8080/partners' -i -X GET |
||||
|
---- |
@ -0,0 +1,6 @@ |
|||||
|
[source,http,options="nowrap"] |
||||
|
---- |
||||
|
GET /partners HTTP/1.1 |
||||
|
Host: localhost:8080 |
||||
|
|
||||
|
---- |
@ -0,0 +1,8 @@ |
|||||
|
[source,http,options="nowrap"] |
||||
|
---- |
||||
|
HTTP/1.1 200 OK |
||||
|
Content-Type: application/json |
||||
|
Content-Length: 1360 |
||||
|
|
||||
|
[{"id":1,"name":"B2boost","reference":"FYI1","locale":"en_BE","expirationTime":"2022-11-24 17:46:00+01"},{"id":2,"name":"Proximus","reference":"FYI2","locale":"en_BE","expirationTime":"2022-11-24 17:46:00+01"},{"id":3,"name":"KBC Bank","reference":"FYI3","locale":"en_BE","expirationTime":"2022-11-24 17:46:00+01"},{"id":4,"name":"AB InBev","reference":"FYI4","locale":"en_BE","expirationTime":"2022-11-24 17:46:00+01"},{"id":5,"name":"Spotify","reference":"FYI5","locale":"sv_SE","expirationTime":"2022-11-24 17:46:00+01"},{"id":6,"name":"AMSOM-Habitat","reference":"FYI6","locale":"fr_FR","expirationTime":"2022-11-24 17:46:00+01"},{"id":7,"name":"Microsoft","reference":"FYI7","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":8,"name":"Sony","reference":"FYI8","locale":"ja_JP","expirationTime":"2022-11-24 17:46:00+09"},{"id":9,"name":"Intel","reference":"FYI9","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":10,"name":"Cisco","reference":"FYI10","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":11,"name":"Dell","reference":"FYI11","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":12,"name":"Canonical","reference":"FYI12","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":13,"name":"UPS","reference":"FYI25","locale":"en_BE","expirationTime":"2013-10-03 12:18:46+01"}] |
||||
|
---- |
@ -0,0 +1,4 @@ |
|||||
|
[source,bash] |
||||
|
---- |
||||
|
$ http GET 'http://localhost:8080/partners' |
||||
|
---- |
@ -0,0 +1,4 @@ |
|||||
|
[source,options="nowrap"] |
||||
|
---- |
||||
|
|
||||
|
---- |
@ -0,0 +1,4 @@ |
|||||
|
[source,options="nowrap"] |
||||
|
---- |
||||
|
[{"id":1,"name":"B2boost","reference":"FYI1","locale":"en_BE","expirationTime":"2022-11-24 17:46:00+01"},{"id":2,"name":"Proximus","reference":"FYI2","locale":"en_BE","expirationTime":"2022-11-24 17:46:00+01"},{"id":3,"name":"KBC Bank","reference":"FYI3","locale":"en_BE","expirationTime":"2022-11-24 17:46:00+01"},{"id":4,"name":"AB InBev","reference":"FYI4","locale":"en_BE","expirationTime":"2022-11-24 17:46:00+01"},{"id":5,"name":"Spotify","reference":"FYI5","locale":"sv_SE","expirationTime":"2022-11-24 17:46:00+01"},{"id":6,"name":"AMSOM-Habitat","reference":"FYI6","locale":"fr_FR","expirationTime":"2022-11-24 17:46:00+01"},{"id":7,"name":"Microsoft","reference":"FYI7","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":8,"name":"Sony","reference":"FYI8","locale":"ja_JP","expirationTime":"2022-11-24 17:46:00+09"},{"id":9,"name":"Intel","reference":"FYI9","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":10,"name":"Cisco","reference":"FYI10","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":11,"name":"Dell","reference":"FYI11","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":12,"name":"Canonical","reference":"FYI12","locale":"en_US","expirationTime":"2022-11-24 17:46:00-04"},{"id":13,"name":"UPS","reference":"FYI25","locale":"en_BE","expirationTime":"2013-10-03 12:18:46+01"}] |
||||
|
---- |
@ -0,0 +1,73 @@ |
|||||
|
= Api partner for B2Boost |
||||
|
Doc Writer <https://art-dambrine.ovh [asciidoc @art-dambrine]> |
||||
|
:toc: left |
||||
|
:hide-uri-scheme: |
||||
|
:source-highlighter: highlight.js |
||||
|
|
||||
|
== Framework and build tools |
||||
|
|
||||
|
For this project I chose to use Spring Boot alongside Gradle. |
||||
|
|
||||
|
== Purpose |
||||
|
|
||||
|
Small assignment to assess your capacity to execute a specific request |
||||
|
|
||||
|
It is taking into account some of the software engineering aspects beyond programming, like (non-exhaustive list): |
||||
|
|
||||
|
- Packaging |
||||
|
- Layering |
||||
|
- Error management |
||||
|
- Documentation |
||||
|
- Deployment aspects |
||||
|
- Testing |
||||
|
|
||||
|
This is a contrived example, especially designed to make the candidates exercise a deeper knowledge of the framework, going beyond simple tutorials that can be found online. |
||||
|
|
||||
|
_Credits (Purpose section) : B2Boost_ |
||||
|
|
||||
|
== Api documentation |
||||
|
|
||||
|
In the following document you will find a simple documentation of the API. |
||||
|
Most of the following sections have been generated with https://spring.io/projects/spring-restdocs[Spring Rest Docs]. |
||||
|
|
||||
|
=== Accessing all the partners GET |
||||
|
A `GET` request is used to access all the partners read. |
||||
|
|
||||
|
==== Request structure |
||||
|
include::getAllPartners/http-request.adoc[] |
||||
|
|
||||
|
|
||||
|
==== Example response |
||||
|
include::getAllPartners/http-response.adoc[] |
||||
|
|
||||
|
==== CURL request |
||||
|
include::getAllPartners/curl-request.adoc[] |
||||
|
|
||||
|
|
||||
|
=== Accessing the partner GET |
||||
|
A `GET` request is used to access the partner read. |
||||
|
|
||||
|
==== Request structure |
||||
|
include::getAPartner/http-request.adoc[] |
||||
|
|
||||
|
==== Path Parameters |
||||
|
include::getAPartner/path-parameters.adoc[] |
||||
|
|
||||
|
==== Example response |
||||
|
include::getAPartner/http-response.adoc[] |
||||
|
|
||||
|
==== CURL request |
||||
|
include::getAPartner/curl-request.adoc[] |
||||
|
|
||||
|
|
||||
|
=== Accessing the partner POST |
||||
|
A `POST` request is used to add a partners resource. |
||||
|
|
||||
|
==== Request structure |
||||
|
include::createPartner/http-request.adoc[] |
||||
|
|
||||
|
==== Example response |
||||
|
include::createPartner/http-response.adoc[] |
||||
|
|
||||
|
==== CURL request |
||||
|
include::createPartner/curl-request.adoc[] |
Loading…
Reference in new issue