API

Endpoints

REST API Endpoints of your Sigmie Application.


Below is a list with all API Endpoints

MethodPathAction
GET/health Health Check
GET/v1/index/{ index-name }/document/{ document-id } Get Document
POST/v1/index/{ index-name }/document/{ document-id } Upsert Document
DELETE/v1/index/{ index-name }/document/{ document-id } Delete Document
PATCH/v1/index/{ index-name }/document/{ document-id } Patch Document
POST/v1/index/{ index-name }/batch Batch Read
PUT/v1/index/{ index-name }/batch Batch Write
POST/v1/search/{ search-name } Search
POST/v1/index/{ index-name } Create Index
DELETE/v1/index/{ index-name } Delete Index
POST/v1/index/{ index-name }/clear Clear Index

Host

Use the host below to access your Sigmie Application API.

  • {application-id}.sigmie.app

Even though this host will work just fine in the majority of situations, it's advised to use a Round-n-Robin retry strategy for the following hosts.

  • {application-id}-a.sigmie.app
  • {application-id}-b.sigmie.app
  • {application-id}-c.sigmie.app

To ensure high availability, we are creating 3 servers for each Sigmie Application. Each one has one of the above DNS entries.

Path: /v1/search/{ search-name }

HTTP Verb: POST

API Key Type: [ Search , Admin ]

Request Body

{
  "query": "peter pan",
  "per_page": 3,
  "page": 1,
  "filter": {
    "active": true
  }
}

Example

curl -X POST \
     -H "Content-Type: application/json" \
     -H "X-Sigmie-API-Key: ${API_KEY}" \
     -H "X-Sigmie-Application: ${APPLICATION_ID}" \
     -d '{"query":"peter pan","per_page":3,"page":1}' \
     "https://${APPLICATION_ID}.sigmie.app/v1/search/disney-movies"

Response - 200 Ok

{
  "hits": {
    "Ont8qIIBrbFU6hq5wjQx": {
      "_id": "Ont8qIIBrbFU6hq5wjQx",
      "_score": 7.398651,
      "name": "Peter Pan",
      "category": ["Fantasy", "Adventure"],
      "_highlight": {
        "category": ["<b>Adventure</b>"]
      },
      "release_year": "1953",
      "duration_minutes": 76
    },
    "M3t8qIIBrbFU6hq5wjQx": {
      "_id": "M3t8qIIBrbFU6hq5wjQx",
      "_score": 7.398651,
      "_highlight": {
        "category": ["<b>Adventure</b>"]
      },
      "name": "Treasure Planet",
      "category": ["Adventure", "Sci-fi"],
      "release_year": "2002",
      "duration_minutes": 95
    },
    "dns3l4IBrbFU6hq5SC6R": {
      "_id": "dns3l4IBrbFU6hq5SC6R",
      "_score": 7.806194,
      "_highlight": {},
      "name": "Lilo & Stitch",
      "category": ["Family", "Comedy"],
      "release_year": "2002",
      "duration_minutes": 85
    }
  },
  "processing_time": 0.743,
  "total": 30,
  "per_page": 3,
  "query": "adventure 2002",
  "search": "disney-movies",
  "filter": {
    "active": true
  },
  "params": "",
  "index": "disney"
}

Index

Index Create

Path: /v1/index/{ index-name }

HTTP Verb: POST

API Key Type: [ Admin ]

Example

curl -X POST \
     -H "Content-Type: application/json" \
     -H "X-Sigmie-API-Key: ${API_KEY}" \
     -H "X-Sigmie-Application: ${APPLICATION_ID}" \
     "https://${APPLICATION_ID}.sigmie.app/v1/index/disney"

Reponse - 202 Accepted

{
  "name": "disney"
}

Index Delete

Path: /v1/index/{ index-name }

HTTP Verb: DELETE

API Key Type: [ Admin ]

Example

curl -X DELETE \
     -H "Content-Type: application/json" \
     -H "X-Sigmie-API-Key: ${API_KEY}" \
     -H "X-Sigmie-Application: ${APPLICATION_ID}" \
     "https://${APPLICATION_ID}.sigmie.app/v1/index/disney"

Reponse - 202 Accepted

{
  "name": "disney"
}

Index Clear

Path: /v1/index/{ index-name }/clear

HTTP Verb: POST

API Key Type: [ Admin ]

Example

curl -X POST \
     -H "Content-Type: application/json" \
     -H "X-Sigmie-API-Key: ${API_KEY}" \
     -H "X-Sigmie-Application: ${APPLICATION_ID}" \
     "https://${APPLICATION_ID}.sigmie.app/v1/index/disney/clear"

Reponse - 202 Accepted

{
  "name": "disney"
}

Document

Upsert

Path: /v1/index/{ index-name }/document/{ document-id }

HTTP Verb: POST

API Key Type: [ Admin ]

Request Body

{
  "name": "Mulan",
  "category": ["Musica", "Family"],
  "release_year": "1998",
  "duration_min": 88
}

Example

curl -X POST \
     -H "Content-Type: application/json" \
     -H "X-Sigmie-API-Key: ${API_KEY}" \
     -H "X-Sigmie-Application: ${APPLICATION_ID}" \
     -d '{"name":"Mulan","category":["Musica","Family"],"release_year":"1998","duration_min":88}' \
     "https://${APPLICATION_ID}.sigmie.app/v1/index/disney/document"

Reponse - 201 Created

{
  "_id": "fXE6OoIBtixTeHPNKXnG",
  "name": "Mulan",
  "category": ["Musica", "Family"],
  "release_year": "1998",
  "duration_min": 88
}

Get

Path: /v1/index/{ index-name }/document/{ document-id }

HTTP Verb: GET

API Key Type: [ Admin ]

Example

curl -X GET \
     -H "Content-Type: application/json" \
     -H "X-Sigmie-API-Key: ${API_KEY}" \
     -H "X-Sigmie-Application: ${APPLICATION_ID}" \
     "https://${APPLICATION_ID}.sigmie.app/v1/index/disney/document/fXE6OoIBtixTeHPNKXnG"

Reponse - 200 Ok

{
  "_id": "fXE6OoIBtixTeHPNKXnG",
  "name": "Mulan",
  "category": ["Musica", "Family"],
  "release_year": "1998",
  "duration_min": 88
}

Patch

Path: /v1/index/{ index-name }/document/{ document-id }

HTTP Verb: PUT

API Key Type: [ Admin ]

Request Body

{
  "duration_min": 93
}

Example

curl -X PUT \
     -H "Content-Type: application/json" \
     -H "X-Sigmie-API-Key: ${API_KEY}" \
     -H "X-Sigmie-Application: ${APPLICATION_ID}" \
     -d '{"duration_min":93}' \
     "https://${APPLICATION_ID}.sigmie.app/v1/index/disney/document/fXE6OoIBtixTeHPNKXnG"

Reponse - 200 Ok

{
  "_id": "fXE6OoIBtixTeHPNKXnG",
  "name": "Mulan",
  "category": ["Musica", "Family"],
  "release_year": "1998",
  "duration_min": 93
}

Delete

Path: /v1/index/{ index-name }/document/{ document-id }

HTTP Verb: DELETE

API Key Type: [ Admin ]

Example

curl -X DELETE \
     -H "Content-Type: application/json" \
     -H "X-Sigmie-API-Key: ${API_KEY}" \
     -H "X-Sigmie-Application: ${APPLICATION_ID}" \
     "https://${APPLICATION_ID}.sigmie.app/v1/index/disney/document/fXE6OoIBtixTeHPNKXnG"

Reponse - 202 Accepted

{
  "_id": "fXE6OoIBtixTeHPNKXnG"
}

Batch Read

Path: /v1/index/{ index-name }/batch

HTTP Verb: POST

API Key Type: [ Admin ]

Request Body

[
  {
    "_id": "dHt8qIIBrbFU6hq5wjQx"
  },
  {
    "_id": "h3t8qIIBrbFU6hq5wjQx"
  },
  {
    "_id": "Mnt8qIIBrbFU6hq5wjQx"
  }
]

Example

curl -X POST \
     -H "Content-Type: application/json" \
     -H "X-Sigmie-API-Key: ${API_KEY}" \
     -H "X-Sigmie-Application: ${APPLICATION_ID}" \
     -d '[{"_id":"dHt8qIIBrbFU6hq5wjQx"},{"_id":"h3t8qIIBrbFU6hq5wjQx"},{"_id":"Mnt8qIIBrbFU6hq5wjQx"}]' \
     "https://${APPLICATION_ID}.sigmie.app/v1/index/disney/batch"

Reponse - 200 Ok

[
  {
    "_id": "dHt8qIIBrbFU6hq5wjQx",
    "name": "Pocahontas",
    "category": ["Musica", "Family"],
    "release_year": "1995",
    "duration_min": 81
  },
  {
    "_id": "h3t8qIIBrbFU6hq5wjQx",
    "name": "Bambi",
    "category": ["Fantasy", "Family"],
    "release_year": "1942",
    "duration_min": 70
  },
  {
    "_id": "Mnt8qIIBrbFU6hq5wjQx",
    "name": "The Emperor's New Groove",
    "category": ["Comedy", "Family"],
    "release_year": "2000",
    "duration_min": 75
  }
]

Batch Write

Path: /v1/index/{ index-name }/batch

HTTP Verb: PUT

API Key Type: [ Admin ]

Request Body

[
  // actions
]

Reponse - 200 Ok

[
  // action responses
]

Create

Body

{
  "action": "create",
  "body": {
    "name": "101 Dalmatians",
    "category": ["Comedy", "Family"],
    "release_year": "1961",
    "duration_min": 79
  }
}

Response

{
  "_id": "j8lmj4EBetGDRrvvlbNf",
  "result": "created"
}

Results

  • created

Upsert

Body

{
  "action": "update",
  "_id": "9q6Sy4MBs1uM0PSSE68v",
  "body": {
    "name": "101 Dalmatians",
    "category": ["Comedy", "Family"],
    "release_year": "1961",
    "duration_min": 79
  }
}

Response

{
  "_id": "j8lmj4EBetGDRrvvlbNf",
  "result": "created"
}

Results

  • created
  • updated

Patch

Body

{
  "action": "update",
  "_id": "36VtPoIB1B0E8pmVb4",
  "body": {
    "name": "The Jungle Book",
    "release_year": "1967"
  }
}

Response

{
  "_id": "36VtPoIB1B0E8pmVb4",
  "result": "updated"
}

Results

  • created
  • updated
  • noop

Delete

Body

{
  "action": "delete",
  "_id": "PkOoIBJq3of4094YiE"
}

Response

{
  "_id": "PkOoIBJq3of4094YiE",
  "result": "deleted"
}

Results

  • deleted
  • not_found

Batch Example

curl -X PUT \
     -H "Content-Type: application/json" \
     -H "X-Sigmie-API-Key: ${API_KEY}" \
     -H "X-Sigmie-Application: ${APPLICATION_ID}" \
     -d '[{"action":"delete","_id":"PkOoIBJq3of4094YiE"},{"action":"update","_id":"36VtPoIB1B0E8pmVb4","body":{"name":"The Jungle Book","release_year":"1967"}},{"action":"Create","body":{"name":"101 Dalmatians","category":["Comedy","Family"],"release_year":"1961","duration_min":79}}]' \
     "https://${APPLICATION_ID}.sigmie.app/v1/index/disney/batch"
Previous
Search