Skip to content
Adrian-St edited this page Dec 6, 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/images',
params: {
    "type":"image"
    "search": "class diagram",
    "start_date": "2018-11-14T12:24:54.601004",
    "end_date": "2018-11-14T12:54:54.601004",
    "offset": 0,
    "limit": 10
}

Response:

STATUS_CODE: 200
{
    "images": [
        {
            "id": "b9bd4e1f-c1b5-43d2-b67a-e60a451d355d",
            "type": "image",
            "created_at": "2018-12-06T15:30:01.738524",
            "updated_at": "2018-12-06T15:30:01.738524",
            "tags": ["some","tags"],
            "file_date": "2018-12-06T15:30:01.725524",
            "url": "localhost/ed081844-37bf-4416-8459-08a96d733426_class_diagram.jpg",
            "score": 0
        },
    ]
}

Request:

GET 'http://127.0.0.1:5000/images/e0469c41-f0c3-419b-bed1-44d19d5fcb24'

Response:

STATUS_CODE: 200
{
    "id": "e0469c41-f0c3-419b-bed1-44d19d5fcb24",
    "created_at": "2018-12-06T15:38:15.101153",
    "updated_at": "2018-12-06T15:38:15.101153",
    "type": "image",
    "tags": [],
    "file_date": "2018-12-06T15:38:15.087147",
    "url": "localhost/e657660e-8c4c-4cf8-9b55-a8c395382531_class_diagram.jpg"
}

Request:

POST 'http://127.0.0.1:5000/images', 
Header: Content-Type: multipart/form-data`, 
data: { "image": BYTESTRING }

Response:

STATUS_CODE: 201
{
    {
        "id": "b9bd4e1f-c1b5-43d2-b67a-e60a451d355d",
        "created_at": "2018-12-06T15:30:01.738524",
        "updated_at": "2018-12-06T15:30:01.738524",
        "type": "image",
        "file_url": "ed081844-37bf-4416-8459-08a96d733426_Background.jpg",
        "tags": [],
        "file_date": "2018-12-06T15:30:01.725524"
    }
}

Request:

PUT 'http://127.0.0.1:5000/images/db20072d-38dc-4226-83ff-f204b4366118', 
Header: Content-Type: application/json`, 
Body: {
    "file_url":"anthoer_url",
    "tags": ["New", "Tags"]
}

Response:

STATUS_CODE: 204

Request:

DELETE 'http://127.0.0.1:5000/images/db20072d-38dc-4226-83ff-f204b4366118'

Response:**

STATUS_CODE: 204

Request:

POST 'http://127.0.0.1:5000/images/db20072d-38dc-4226-83ff-f204b4366118/tags', 
Header: Content-Type: application/json`, 
Body: {
    "tags": ["New", "Tags"]
}

Response:

STATUS_CODE: 204
Clone this wiki locally