Delete

This method allows to delete existing enum value by its 'id'.

See Where for more details.

Method

DELETE

URI

/api/enum_values

Headers

Content-Type	application/json
Authorization   Bearer <short-access-token>

Body

{
    "filter": {
        "where": {
            "operator": "=",
            "args": [
                "id",
                106
            ]
        }
    },
    "context": {
        "enumId": 48
    }
}

Result

[
    {
        "id": 106,
        "systemName": "5a546bb9-95f9-4d75-ab8b-babf69dd3083",
        "label": "Pink",
        "options": {
            "order": 1
        },
        "enumId": 48,
        "createdAt": "2020-04-07T15:45:50.241Z",
        "updatedAt": "2020-04-07T16:50:34.562Z"
    }
]

Examples

var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer <short-access-token>");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("X-HTTP-Method-Override", "DELETE");

var raw = JSON.stringify({
  "filter": {
    "where": {
      "operator": "=",
      "args": ["id", 105]
    }
  },
  "context": {
    "enumId": 48
  }
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://backend.spacemonopoly3d.com/api/enum_values", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://backend.spacemonopoly3d.com/api/enum_values',
  'headers': {
    'Authorization': 'Bearer <short-access-token>',
    'Content-Type': 'application/json',
    'X-HTTP-Method-Override': 'DELETE'
  },
  body: JSON.stringify({
    "filter": {
      "where": {
        "operator": "=",
        "args": ["id", 105]
      }
    },
    "context": {
      "enumId": 48
    }
  })

};
request(options, function (error, response) { 
  if (error) throw new Error(error);
  console.log(response.body);
});
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://backend.spacemonopoly3d.com/api/enum_values');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'Authorization' => 'Bearer <short-access-token>',
  'Content-Type' => 'application/json',
  'X-HTTP-Method-Override' => 'DELETE'
));
$request->setBody(json_encode(array(
  "filter" => array(
    "where" => array(
      "operator" => "=",
      "args" => ["id", 105]
    )
  ),
  "context" => array(
    "enumId" => 48
  )
)));
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}