Delete a Warrant
Delete a warrant, if it exists. The warrant to be deleted is specified by the combination of the objectType
, objectId
, relation
, subject
, and (optionally) policy
provided in the delete request.
DELETE /v2/warrants
Request
Body
objectType string
The type of object. Must be one of your system's existing object types.
objectId string
The id of the specific object.
relation string
The relation for this object to subject association. The relation must be valid as per the object type definition.
subject object
The subject for which this warrant applies. Subject can be a specific object (by id) or a set of objects matching the given objectType, objectId and relation.
policy string
, optional
A boolean expression that must evaluate to true
for this warrant to apply. The expression can reference variables that are provided in the context
attribute of access check requests. See Key Concepts > Warrants > Policies & Context to learn more about writing policies.
- cURL
- CLI
- Go
- Java
- Node.js
- PHP
- Python
- Ruby
curl "https://api.warrant.dev/v2/warrants" \
-X DELETE \
-H "Authorization: ApiKey YOUR_KEY" \
--data-raw \
'{
"objectType": "report",
"objectId": "23ft346",
"relation": "editor",
"subject": {
"objectType": "user",
"objectId": "15ads7823a9df7as433gk23dd"
}
}'
warrant remove user:15ads7823a9df7as433gk23dd editor report:23ft346
err := warrant.Delete(&warrant.WarrantParams{
ObjectType: "report",
ObjectId: "23ft346",
Relation: "editor",
Subject: warrant.Subject{
ObjectType: "user",
ObjectId": "15ads7823a9df7as433gk23dd",
},
})
if err != nil {
// handle error
}
try {
Report report = new Report("23ft346"); // assuming 'Report' implements the 'WarrantObject' interface
String warrantToken = client.deleteWarrant(report, "editor", new WarrantSubject("user", "15ads7823a9df7as433gk23dd"));
} catch (WarrantException e) {
// Handle error
}
const warrantToken = await warrantClient.Warrant.delete({
object: {
objectType: "report",
objectId: "23ft346",
},
relation: "editor",
subject: { objectType: "user", objectId: "15ads7823a9df7as433gk23dd" },
});
$subject = new \Warrant\Subject("user", "15ads7823a9df7as433gk23dd");
$warrant->deleteWarrant(new \Warrant\Warrant("report", "23ft346", "editor", $subject));
user_subject = warrant.Subject("user", "15ads7823a9df7as433gk23dd")
warrant_token = warrant.Warrant.delete(object_type="report", object_id="23ft346", relation="editor", subject=user_subject)
Warrant::Warrant.delete({ object_type: "report", object_id: "23ft346" }, "editor", { object_type: "user", object_id: "15ads7823a9df7as433gk23dd" })
Response
Headers
Warrant-Token string
A unique transaction identifier for this write operation. Can be cached and passed on subsequent read requests.
Body
objectType string
The type of object. Must be one of your system's existing object types.
objectId string
The id of the specific object.
relation string
The relation for this object to subject association. The relation must be valid as per the object type definition.
subject object
The subject for which this warrant applies. Subject can be a specific object (by id) or a set of objects matching the given objectType, objectId and relation.
policy string
A boolean expression that must evaluate to true
for this warrant to apply. The expression can reference variables that are provided in the context
attribute of access check requests. See Key Concepts > Warrants > Policies & Context to learn more about writing policies.
200 OK