Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

This document will define steps to delete the contents of a schema by using the API directly. Postman application is used here to trigger the API endpoint.

  • Please frame the endpoint to hit the delete action.

Endpoint URL: {{domainURL}}/api/schema/{{schema_keyValue}}/data?projectId={{projectID}}

Sample endpoint: https://example.orbita-eng.cloud:8443/api/schema/sampleschema/data?projectId=628e1ced1fc9c700730133d4

  • The schema key value can be viewed on the Schema page

Postman application steps

Use the Postman application for hitting the endpoint. Please refer to the following parameters that you will need.

Parameter

Value

Method

DELETE

Headers

KEY: Content-Type
Value: application/json

Headers

KEY: Authorization
Value: {{Insert the Bearer token from the user login}}

Body

The filter object can be used to filter the data to perform the delete action.

1. To select all documents in the collection, pass an empty document as the query filter parameter

{
    "filter": {}
}

2. The following example selects from the dynamic data collection all documents where the hospitalNameequals "Apollo Hospitals"

{
    "filter": {"hospitalName": "Apollo Hospitals"}
}

3. The following example selects all documents from the dynamic data collection where hospitalName equals either "Apollo Hospitals" or "Mayo Clinic"

{
    "filter": {"hospitalName": {$in:["Apollo Hospitals","Mayo Clinic"]}}
}

4. The following example selects all documents in the dynamic data collection where the hospitanName equals "Apollo Hospitals" and rating is less than ($lt) 3

{
    "filter": {"hospitalName": "Apollo Hospitals", rating:{$lt: 3}}
}

5. The following example selects all documents in the dynamic data collection where the hospitalName equals "Apollo Hospitals" or ratin is less than ($lt) 3

{
    "filter": {$or:[{"hospitalName": "Apollo Hospitals"},{rating:{$lt:3}}]}
}

6. In the following example, the compound query document selects all documents in the dynamic data collection where the hospitalName equals "ApolloHospitals" and either rating is less than ($lt) 3 or location starts with the character p:

{
    "filter": {"hospitalName": "Apollo Hospitals", $or:[{rating:{$lt: 3}},{location: /^p/}]}
}

Sample Response

{
  "ok": 1,
  "writeErrors": [],
  "writeConcernErrors": [],
  "insertedIds": [],
  "nInserted": 0,
  "nUpserted": 0,
  "nMatched": 0,
  "nModified": 0,
  "nRemoved": 12,
  "upserted": [],
  "lastOp": {
    "ts": "7106831085601816578",
    "t": 443
  }
}

After the delete action is done, the response will have the object nRemoved populated with the count of records that were deleted.

  • No labels