Swagger UI & Examples
  • Print
  • Share
  • Dark
    Light

Swagger UI & Examples

  • Print
  • Share
  • Dark
    Light

The Dataloop Swagger UI offers the ability to perform API requests such as GET, POST, PUT, PATCH and DELETE to different endpoints in our backend services like projects, datasets, tasks, etc.
In order to use the Swagger UI you will need to be logged in from another tab. An authentication will be completed with the logged in user.

df4c308-swagger.png

Notice that you have to be logged into the platform in the same window to be able to enter the swagger

Example for GET Projects List

Find the Projects endpoint, select the GET method and click Try it out
7dd736e-getproject.png

Click Execute
6f23d75-Try.png

Response in a JSON Format


{
    "contributors": [
      {
        "createdAt": 1582055111029,
        "updatedAt": 1582055111029,
        "id": "nicolas.dataloop@gmail.com",
        "username": "nicolas.dataloop@gmail.com",
        "firstName": "nicolas",
        "lastName": "cage",
        "email": "nicolas.dataloop@gmail.com",
        "avatar": "https://lh3.googleusercontent.com/a-/AAuE7mBTLxIT1f8RTp_NoQ7nWS_l6kqNAyoU70zoMKV1",
        "type": null,
        "org": null
      }
    ],
    "createdAt": 1582821754850,
    "updatedAt": 1582821754850,
    "id": "e9dc63c1-be3f-45ca-82f6-036040cd0ef1",
    "name": "My project",
    "featureConstraints": [
      {
        "name": "downloadJsons",
        "quota": 0,
        "title": "Download Annotation as Json"
      }
    ],
    "creator": "nicolas.dataloop@gmail.com",
    "org": null,
    "account": null,
    "role": "owner"
  }
  

Example for POST Datasets Query for Items (Item count)

By posting a simple query on a Datasets endpoint, you can use the dataset ID and query to get the requested items.

Filters are used to specify the annotation type and label required.

c1149ed-Annotations.png

Inputting Dataset ID and the specific query

The query used in the example above is to get all items with the label Car and annotation type Bounding Box .

🚧 Learn More About Our Query Language

To better Search, filer, sort and update your data go to DQL (The Data Query Engine) page.

{
   "resource":"items",
   "filter":{
      "$and":[
         {
            "type":"file"
         },
         {
            "hidden":false
         }
      ]
   },
   "join":{
      "on":{
         "resource":"annotations",
         "local":"itemId",
         "forigen":"id"
      },
      "filter":{
         "$and":[
            {
               "label":{
                  "$in":[
                     "Car"
                  ]
               }
            },
            {
               "type":{
                  "$in":[
                     "box"
                  ]
               }
            }
         ]
      }
   }
}

The Response body for this query holds 2 items in the dataset. You may see the detailed information for each item under its item metadata.

{
  "totalItemsCount": 2,
  "items": [
    {
      "id": "5e5fdae499d5538db88b8d5f",
      "datasetId": "5e5fdad764cab43156881739",
      "createdAt": "2020-03-04T16:44:20.000Z",
      "dir": "/",
      "filename": "/18407C.JPG",
      "type": "file",
      "hidden": false,
      "metadata": {
        "system": {
          "originalname": "18407C.JPG",
          "size": 340727,
          "encoding": "7bit",
          "mimetype": "image/jpeg",
          "annotationStatus": [],
          "refs": [],
          "executionLogs": {
            "image-metadata-extractor": {
              "default_module": {
                "run": {
                  "5e5fdae44eac5e41d231dbf4": {
                    "progress": 100,
                    "status": "success"
                  }
                }
              }
            }
          },
          "exif": {},
          "height": 1007,
          "width": 1600
        }
      },
      "name": "18407C.JPG",
      "url": "https://gate.dataloop.ai/api/v1/items/5e5fdae499d5538db88b8d5f",
      "dataset": "https://gate.dataloop.ai/api/v1/datasets/5e5fdad764cab43156881739",
      "annotated": true,
      "stream": "https://gate.dataloop.ai/api/v1/items/5e5fdae499d5538db88b8d5f/stream",
      "thumbnail": "https://gate.dataloop.ai/api/v1/items/5e5fdae499d5538db88b8d5f/thumbnail",
      "annotations": "https://gate.dataloop.ai/api/v1/items/5e5fdae499d5538db88b8d5f/annotations"
    },
    {
      "id": "5e5fdae4659f5f1a7b74901d",
      "datasetId": "5e5fdad764cab43156881739",
      "createdAt": "2020-03-04T16:44:20.000Z",
      "dir": "/",
      "filename": "/18407.JPG",
      "type": "file",
      "hidden": false,
      "metadata": {
        "system": {
          "originalname": "18407.JPG",
          "size": 238418,
          "encoding": "7bit",
          "mimetype": "image/jpeg",
          "annotationStatus": [],
          "refs": [],
          "executionLogs": {
            "image-metadata-extractor": {
              "default_module": {
                "run": {
                  "5e5fdae4b314cc1a13c399d7": {
                    "progress": 100,
                    "status": "success"
                  }
                }
              }
            }
          },
          "exif": {},
          "height": 1041,
          "width": 1291
        }
      },
      "name": "18407.JPG",
      "url": "https://gate.dataloop.ai/api/v1/items/5e5fdae4659f5f1a7b74901d",
      "dataset": "https://gate.dataloop.ai/api/v1/datasets/5e5fdad764cab43156881739",
      "annotated": true,
      "stream": "https://gate.dataloop.ai/api/v1/items/5e5fdae4659f5f1a7b74901d/stream",
      "thumbnail": "https://gate.dataloop.ai/api/v1/items/5e5fdae4659f5f1a7b74901d/thumbnail",
      "annotations": "https://gate.dataloop.ai/api/v1/items/5e5fdae4659f5f1a7b74901d/annotations"
    }
  ],
  "totalPagesCount": 1,
  "hasNextPage": false
}

Example for POST Datasets Query for Annotations(annotation count)

In the below example you can use the query to get the annotation count for all the Bounding Box with the labels dogs

{
   "resource":"annotations",
   "filter":{
      "$and":[
         {
            "label":{
               "$in":[
                  "dogs"
               ]
            }
         },
         {
            "type":{
               "$in":[
                  "box"
               ]
            }
         }
      ]
   }
}
Was This Article Helpful?