Skip to content

Commit

Permalink
Improving Document API
Browse files Browse the repository at this point in the history
  • Loading branch information
mmachicadoCB committed Dec 7, 2018
1 parent aee5d27 commit b4989a9
Showing 1 changed file with 236 additions and 23 deletions.
259 changes: 236 additions & 23 deletions DocumentAPI.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
# Document API

/Document

## POST
```sh
/corporate/candidatesearch/document
```
## Update Document

Handles update Request. Must set Content-Type = application/json in header. Parameter type: BODY
**Method:** POST
**URL:** /corporate/candidatesearch/document
Optional query string parameters:
- document_id, if do cument if is not provided email should be provided
- email, if email is not provided document_id should be provided
- request_id
- pool

### Parameter

|Field|Type|Description|
|--- |--- |--- |
|document_id|string||
|update_fields|UpdateField[]||
|name|string||
|value|string||
|customer_key|string||
|request_id optional|string||
|document_id|string|Document identificator. MaxLength: 50|
|email|string|Email that will be used to retrieve documents that belong to that email. Max 128 characters.|
|update_fields|UpdateField[]|Array that contains the fields that will be updated|
|name|string|Name of the field to be updated, example: email|
|value|string|Value of the field provided in the name, example: [email protected]|
|customer_key|string|The customer Key|
|request_id|string|Request Identificator|
|pool|string|Name of the pool that will be used, by default it will use privatecandidates|

### Request Body

```json
{
"document_id": "",
"email": "",
"pool": "",
"update_fields": [
{
"name": "",
Expand All @@ -33,7 +46,6 @@ Handles update Request. Must set Content-Type = application/json in header. Para

### Response

Success 200

|Field|Type|Description|
|--- |--- |--- |
Expand All @@ -59,7 +71,58 @@ Success 200
|SearchResultDIDs|string[]||
|ErrorReturnedFromSolrSearch|string[]||

## PUT
**Sample request:**
```json
{
"document_id": "3F1AASDQWAS123123",
"update_fields": [{
"name": "skill_list",
"value": ["Java"]
}],
"customer_key": "CSTESTSQUIRRELY00001"
}
```

**Sample response:**

```json
{
"data": {
"status_message": "Customer was successfully updated.",
"status_code": 200
},
"timing": {
"time_received": "2016-12-06T19:41:46.7711185Z",
"time_elapsed": 14.2441964
},
"forensics": {
"input": {
"document_id": "3F1AASDQWAS123123",
"update_fields": [
{
"name": "skill_list",
"value": [
"Java"
]
}
],
"customer_key": "CSTESTSQUIRRELY00001",
"request_id": "CSREQ0061N65B5W8X043C5V"
},
"internal_forensics": {
"StatusCodeReturnedFromSearchCore": 0
}
}
}
```


## Create Document

**Method:** PUT
**URL:** /corporate/candidatesearch/document
Optional query string parameters:
- request_id

Handles Create Request. Must set Content-Type = application/json in header. Parameter type: BODY. Custom fields can be passed like standard fields. Please look at example.

Expand Down Expand Up @@ -109,7 +172,7 @@ Handles Create Request. Must set Content-Type = application/json in header. Para
|graduation_date|string||
|customer_key|string||
|request_id optional|string||

### Request Body
```json
{
"document_id": "",
Expand Down Expand Up @@ -170,8 +233,6 @@ Handles Create Request. Must set Content-Type = application/json in header. Para

### Response

Success 200

|Field|Type|Description|
|--- |--- |--- |
|string||DID|
Expand All @@ -197,21 +258,80 @@ Success 200
|SearchResultDIDs|string[]||
|ErrorReturnedFromSolrSearch|string[]||

**Sample request:**
```json
{
"document_id": "3F1AASDQWAS123123",
"email": "[email protected]",
"first_name": "test",
"last_name": "test",
"country": "US",
"resume_description": "Test for Document Creation",
"pool": "privatecandidates",
"skill_list": [
"Java"
],
"customer_key": "CSTESTSQUIRRELY00001"
}
```

**Sample response:**

## GET
```json
{
"data": {
"status_message": "Applicant was successfully indexed.",
"status_code": 200
},
"timing": {
"time_received": "2018-12-06T19:47:38.1486562Z",
"time_elapsed": 9.1482392
},
"forensics": {
"input": {
"document_id": "3F1AASDQWAS123123",
"email": "[email protected]",
"first_name": "test",
"last_name": "test",
"latitude": 0.0,
"longitude": 0.0,
"country": "US",
"total_years_experience": 0.0,
"resume_description": "Test for Document Creation",
"skill_list": [
"Java"
],
"priority": 0,
"company_experience_list": [],
"education_list": [],
"custom_field_list": [],
"pool": "privatecandidates",
"customer_key": "CSTESTSQUIRRELY00001",
"request_id": "CSREQ006FZ6NT8VC310B5VX"
},
"internal_forensics": {
"StatusCodeReturnedFromSearchCore": 0
}
},
"CompositeID": "CSTESTSQUIRRELY00001|3F1AASDQWAS123123"
}
```

## Retrieve a document

Customer Key and Document Key are required to search for a single document. Parameter type: QUERY

**Method:** GET
**URL:** /corporate/candidatesearch/document?**Parameters**

### Parameter

|Field|Type|Description|
|--- |--- |--- |
|customer_key|string||
|document_id|string||

### Response

Success 200
### Response Body

|Field|Type|Description|
|--- |--- |--- |
Expand All @@ -237,10 +357,76 @@ Success 200
|SearchResultDIDs|string[]||
|ErrorReturnedFromSolrSearch|string[]||

## DELETE
**Sample request:**
```sh
/corporate/candidatesearch/document?customer_key=CSTESTSQUIRRELY00001&document_id=3F1AASDQWAS123123
```

**Sample response:**

```json
{
"data": {
"document": {
"customer_key": "CSTESTSQUIRRELY00001",
"document_id": "3F1AASDQWAS123123",
"email": "[email protected]",
"first_name": "test",
"last_name": "test",
"address_1": "",
"city": "",
"admin_area_1": "",
"postal_code": "",
"latitude": 0.00000,
"longitude": 0.00000,
"country": "US",
"phone": "",
"currently_employed": "",
"total_years_experience": 0.00000,
"resume_description": "Test for Document Creation",
"activity_history": "",
"skill_list": "Java",
"education_list": [],
"company_experience_list": []
},
"status_code": 200
},
"timing": {
"time_received": "2018-12-06T19:54:33.6089440Z",
"time_elapsed": 2.7219459
},
"forensics": {
"input": {
"radius": 0.0,
"enable_multi_facet": false,
"start_page": 0,
"results_per_page": 10,
"group_by_candidate": false,
"group_by_candidate_limit": 1,
"by_candidate": false,
"indecisive_facets": false,
"debug": false,
"show_reasons": false,
"sort_by_distance": false,
"solr_score": false,
"semantic": false,
"customer_key": "CSTESTSQUIRRELY00001",
"request_id": "CSREQ003TW6Z58R03KXL38P"
},
"internal_forensics": {
"StatusCodeReturnedFromSearchCore": 0
}
}
}
```

## Delete a Document

Customer Key and Document Key are required. Must set Content-Type = application/json in header. Parameter type: QUERY

**Method:** DELETE
**URL:** /corporate/candidatesearch/document?**Parameters**

### Parameter

|Field|Type|Description|
Expand All @@ -249,9 +435,7 @@ Customer Key and Document Key are required. Must set Content-Type = application/
|document_id|string|Note: either provide the document_id or the DIDs|
|DIDs|string|Note: either provide the document_id or the DIDs|

### Response

Success 200
### Response Body

|Field|Type|Description|
|--- |--- |--- |
Expand All @@ -276,3 +460,32 @@ Success 200
|SearchException|string||
|SearchResultDIDs|string[]||
|ErrorReturnedFromSolrSearch|string[]||

**Sample request:**
```sh
/corporate/candidatesearch/document?customer_key=CSTESTSQUIRRELY00001&document_id=3F1AASDQWAS123123
```

**Sample response:**

```json
{
"data": {
"status_code": 200
},
"timing": {
"time_received": "2018-12-06T19:59:22.6824285Z",
"time_elapsed": 5.280952
},
"forensics": {
"input": {
"document_id": "3F1AASDQWAS123123",
"customer_key": "CSTESTSQUIRRELY00001",
"request_id": "CSREQ004C06WC2FF7MY52H8"
},
"internal_forensics": {
"StatusCodeReturnedFromSearchCore": 0
}
}
}
```

0 comments on commit b4989a9

Please sign in to comment.