From f965878b42a327904d1e76143419abd9c85c34a4 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Mon, 16 Jul 2018 10:28:17 +0300 Subject: [PATCH] Add contact endpoint documentation --- doc/registrant-api/v1/authentication.md | 6 +- doc/registrant-api/v1/contact.md | 148 ++++++++++++++++++++++++ doc/registrant-api/v1/domain.md | 8 +- 3 files changed, 157 insertions(+), 5 deletions(-) create mode 100644 doc/registrant-api/v1/contact.md diff --git a/doc/registrant-api/v1/authentication.md b/doc/registrant-api/v1/authentication.md index f9486f57a..f914a7a23 100644 --- a/doc/registrant-api/v1/authentication.md +++ b/doc/registrant-api/v1/authentication.md @@ -7,7 +7,7 @@ authentication. API client should perform authentication with eID according to the approriate documentation, and then pass on values from the webserver's certificate to the API server. -## POST /repp/v1/registrant/auth/eid/token +## POST /repp/v1/registrant/auth/eid Returns a bearer token to be used for further API requests. Tokens are valid for 2 hours since their creation. @@ -34,7 +34,7 @@ Content-type: application/json { "ident": "30110100103", - "first_name": "Jaan", + "first_name": "Jan", "last_name": "Tamm", "country": "ee", "issuing authority": "AS Sertifitseerimiskeskus" @@ -56,7 +56,7 @@ Content-Type: application.json } ``` -## POST /repp/v1/auth/username/token -- NOT IMPLEMENTED +## POST /repp/v1/auth/username -- NOT IMPLEMENTED #### Paramaters diff --git a/doc/registrant-api/v1/contact.md b/doc/registrant-api/v1/contact.md new file mode 100644 index 000000000..126ae27c6 --- /dev/null +++ b/doc/registrant-api/v1/contact.md @@ -0,0 +1,148 @@ +## GET /repp/v1/registrant/contacts +Returns contacts of the current registrar. + + +#### Parameters + +| Field name | Required | Type | Allowed values | Description | +| ---------- | -------- | ---- | -------------- | ----------- | +| limit | false | Integer | [1..200] | How many contacts to show | +| offset | false | Integer | | Contact number to start at | + +#### Request +``` +GET /repp/v1/registrant/contacts?limit=1 HTTP/1.1 +Accept: application/json +Authorization: Bearer Z2l0bGFiOmdoeXQ5ZTRmdQ== +Content-Type: application/json +``` + +#### Response +``` +HTTP/1.1 200 +Cache-Control: max-age=0, private, must-revalidate +Content-Length: 564 +Content-Type: application/json + +{ + "contacts": [ + { + "uuid": "84c62f3d-e56f-40fa-9ca4-dc0137778949", + "domain_name": "example.com" + "code": "REGISTRAR2:SH022086480", + "phone": "+372.12345678", + "email": "hoyt@deckowbechtelar.net", + "fax": null, + "created_at": "2015-09-09T09:11:14.130Z", + "updated_at": "2015-09-09T09:11:14.130Z", + "ident": "37605030299", + "ident_type": "priv", + "auth_info": "password", + "name": "Karson Kessler0", + "org_name": null, + "registrar_id": 2, + "creator_str": null, + "updator_str": null, + "ident_country_code": "EE", + "city": "Tallinn", + "street": "Short street 11", + "zip": "11111", + "country_code": "EE", + "state": null, + "legacy_id": null, + "statuses": [ + "ok" + ], + "status_notes": { + } + } + ], + "total_number_of_records": 2 +} +``` + +## PUT/PATCH /rep/v1/registrant/contacts/$UUID + +Update contact details for a contact. + +#### Parameters + +| Field name | Required | Type | Allowed values | Description | +| ---- | --- | --- | --- | --- | +| email | false | String | | New email address | +| phone | false | String | | New phone number | +| fax | false | String | | New fax number | +| city | false | String | | New city name | +| street | false | String | | New street name | +| zip | false | String | | New zip code | +| country_code | false | String | | New country code in 2 letter format ('EE', 'LV') | +| state | false | String | | New state name | + + +#### Request +``` +PUT /repp/v1/registrant/contacts/84c62f3d-e56f-40fa-9ca4-dc0137778949 HTTP/1.1 +Authorization: Bearer Z2l0bGFiOmdoeXQ5ZTRmdQ== +Accept: application/json +Content-type: application/json + +{ + "email": "foo@bar.baz", + "phone": "+372.12345671", + "fax": "+372.12345672", + "city": "New City", + "street": "Main Street 123", + "zip": "22222", + "country_code": "LV", + "state": "New state" +} + +``` +#### Response on success + +``` +HTTP/1.1 200 +Content-Type: application.json + +{ + "uuid": "84c62f3d-e56f-40fa-9ca4-dc0137778949", + "domain_name": "example.com" + "code": "REGISTRAR2:SH022086480", + "phone": "+372.12345671", + "email": "foo@bar.baz", + "fax": "+372.12345672", + "created_at": "2015-09-09T09:11:14.130Z", + "updated_at": "2018-09-09T09:11:14.130Z", + "ident": "37605030299", + "ident_type": "priv", + "auth_info": "password", + "name": "Karson Kessler0", + "org_name": null, + "registrar_id": 2, + "creator_str": null, + "updator_str": null, + "ident_country_code": "EE", + "city": "New City", + "street": "Main Street 123", + "zip": "22222", + "country_code": "LV", + "state": "New state" + "legacy_id": null, + "statuses": [ + "ok" + ], + "status_notes": {} +} +``` + +### Response on failure +``` +HTTP/1.1 400 +Content-Type: application.json + +{ + "errors": [ + { "phone": "Phone nr is invalid" } + ] +} +``` diff --git a/doc/registrant-api/v1/domain.md b/doc/registrant-api/v1/domain.md index b39f28cae..5ea82a376 100644 --- a/doc/registrant-api/v1/domain.md +++ b/doc/registrant-api/v1/domain.md @@ -1,7 +1,7 @@ # Domain related actions ## GET /repp/v1/registrant/domains -Returns domains of the current registrar. +Returns domains of the current registrant. #### Parameters @@ -65,7 +65,6 @@ Content-Type: application/json "status_notes": { }, "statuses_backup": [ - ] } ], @@ -100,3 +99,8 @@ Content-Type: application/json "total_number_of_records": 2 } ``` + +#### Implementation details + +This endpoint is practically a copy-paste from similar endpoint used by +registrars.