Skip to content
arne-z edited this page Nov 26, 2018 · 9 revisions

Elasticsearch Doku

API Routes for Elija

Request:

GET 'http://127.0.0.1:5000/'

Response:

STATUS_CODE: 200
{
    "database status": "on",
    "service name": "artefact service"
}

Request:

GET 'http://127.0.0.1:5000/artefacts',
params: {
    "type":"image"    
    "search": "class diagram",
    "start_date": "2018-11-14T12:24:54.601004",
    "end_date": "2018-11-14T12:54:54.601004"
}

Response:

STATUS_CODE: 200
{
    "results": [
        {
            "_id": "db20072d-38dc-4226-83ff-f204b4366118",
            "_index": "artefact",
            "_score": 0.5753642,
            "_source": {
                "created_at": "2018-11-14T12:41:26.754071",
                "file_url": "class_diagram.png",
                "tags": "uml, class diagram, architecture"
            },
            "_type": "image",
            "sort": [
                0.5753642,
                1542199286754
            ]
        }
    ]
}

Request:

GET 'http://127.0.0.1:5000/artefacts/db20072d-38dc-4226-83ff-f204b4366118?type=image'

Response:

STATUS_CODE: 200
{
    "_id": "db20072d-38dc-4226-83ff-f204b4366118",
    "_index": "artefact",
    "_source": {
        "created_at": "2018-11-14T12:41:26.754071",
        "file_url": "class_diagram.png",
        "tags": "uml, class diagram, architecture"
    },
    "_type": "image",
    "_version": 1,
    "found": true
}

Request:

POST 'http://127.0.0.1:5000/artefacts', 
Header: Content-Type: application/json`, 
Body: {
    "type": "image",
    "id": "db20072d-38dc-4226-83ff-f204b4366118",
    "tags":"uml, class diagram, architecture",
    "file_url": "class_diagram.png"
}

Response:

STATUS_CODE: 201
{
    "_id": "db20072d-38dc-4226-83ff-f204b4366118",
    "_index": "artefact",
    "_primary_term": 1,
    "_seq_no": 0,
    "_shards": {
        "failed": 0,
        "successful": 1,
        "total": 2
    },
    "_source": {
        "created_at": "2018-11-14T12:41:26.754071",
        "file_url": "class_diagram.png",
        "tags": "uml, class diagram, architecture"
    },
    "_type": "image",
    "_version": 1,
    "result": "created"
}

Request:

PUT 'http://127.0.0.1:5000/artefacts/db20072d-38dc-4226-83ff-f204b4366118', 
Header: Content-Type: application/json`, 
Body: {
    "type": "image",
    "id": "db20072d-38dc-4226-83ff-f204b4366118",
    "tags":"uml, class diagram, architecture",
    "file_url": "class_diagram.png"
}

Response:

STATUS_CODE: 204

Request:

DELETE 'http://127.0.0.1:5000/artefacts/db20072d-38dc-4226-83ff-f204b4366118?type=image'

Response:**

STATUS_CODE: 204
Clone this wiki locally