Sends an HTTP DELETE request to the specified URL.

Usage Examples

Call from a Function

exports = function() {
    const http ="http");
    return http
      .delete({ url: "" })
      .then(response => {
        // The response body is encoded as raw BSON.Binary. Parse it to JSON.
        const ejson_body = EJSON.parse(resp.body.text());
        return ejson_body;

Call from a Client SDK

import { Stitch } from 'mongodb-stitch-browser-sdk';
import {
} from 'mongodb-stitch-browser-services-http';

const app = Stitch.defaultAppClient;
const http = app.getServiceClient(HttpServiceClient.factory, "http");

const request = new HttpRequest.Builder()

StitchAppClient client = Stitch.getDefaultAppClient();
StitchServiceClient http = client.getServiceClient(HttpServiceClient.factory, "http");

HttpRequest request = new HttpRequest.Builder()

  .addOnCompleteListener(new OnCompleteListener<Void>() {
    public void onComplete(@NonNull final Task<Void> task) {
      if (task.isSuccessful()) { Log.d("stitch", "Successfully sent DELETE request!"); } else { Log.e("stitch", "Error sending DELETE request:", task.getException()); }
let app = Stitch.defaultAppClient!
let http = app.serviceClient(
  fromFactory: httpServiceClientFactory,
  withName: "http"

let request = HTTPRequest(
  url: "",
  method: HTTPMethod.delete

http.execute(request) { result in
  switch result {
  case .success:
    print("Successfully sent DELETE request!")
  case .failure(let error):
    print("Error sending DELETE request: \(error)")


The http.delete() action accepts one argument of the following form:

    "url": <mixed>,
    "headers": <document>,

.. include:: /includes/extracts/http-action-args-delete.rst

Alternative URL Arguments

As an alternative to passing the url or authUrl argument as a single string, you can instead specify the individual components of the URL in a document.

Given the URL of the form:


The url argument is a document with the fields:

   "scheme": <string>,
   "host": <string>,
   "path": <string>,
   "query": <string>,
   "fragment": <string>,
   "username": <string>,
   "password": <string>
Name Contents
scheme Required. Defaults to https. Permissible values are https and http.
host Required. The hostname for the request. In the URL, the hostname is
path The path portion of the URL. In, the path portion is /api/v1.0/entity.

Document containing keys and values which map to the URL’s query string. Each key must be a string and each value must be an array of strings, even if the array contains only one element. For example, given the query document:

{ "x": ["hello"], "y": ["world"] }

The query is appended to the outgoing request as ?x=hello&y=world.

If an array contains more than one element, all the elements are included with the same key. For example, given the query document:

{ "cars": ["Porsche", "Audi"], "bikes": ["Trek", "Marin"] }

The query is appended to the outgoing request as ?cars=Porsche&cars=Audi&bikes=Trek&bikes=Marin.

fragment The portion of the URL which comes after the anchor (#).
username A username used in conjunction with the password argument. Allows the action to access the given URL with basic authentication.
password A password used in conjunction with the username argument. Allows the action to access the given URL with basic authentication.

Return Value

The http.delete() action returns a promise that resolves to a document with the following form:

   "status": <string>,
   "statusCode": <integer>,
   "contentLength": <integer>,
   "headers": <document>,
   "cookies": <array>,
   "body": <binary>
Field Type Description
status string A string representing the HTTP status.
statusCode integer The HTTP status code.
contentLength integer The length of the content returned in body.
headers document Corresponds to the HTTP header fields and the corresponding values are an array of values (e.g. "Content-Type": [ "application/json" ]) for the request.
cookies document Optional. Cookie name and value pairs.
body binary Optional. The raw body of the HTTP response.

Rule Templates

Users Can Only Send Requests to a Specific Host

  "": ""

Requests URLs Must Include a Specific Query Parameter

  "%%args.url.query.someParameter": "importantValue"

Requests Must Be To A Specific Path

  "%%args.url.scheme: "https",
  "" : "",
  "%%args.url.path" : "/api/v1.0/messages"
← http.put()  →