deleteDocument
Deletes a document
Deletes one of the caller's documents; an administrator may delete any. Needs scope documents.delete and a recent strong authentication (RFC 9470). Someone else's document is answered 404, like a missing one.
/api/documents/{id}
Usage and SDK Samples
curl -X DELETE \
-H "Authorization: Bearer [[accessToken]]" \
"http://localhost:8081/api/documents/{id}"
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DocumentsApi;
import java.io.File;
import java.util.*;
public class DocumentsApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure Bearer (JWT) access token for authorization: bearer
HttpBearerAuth bearer = (HttpBearerAuth) defaultClient.getAuthentication("bearer");
bearer.setBearerToken("BEARER TOKEN");
// Create an instance of the API class
DocumentsApi apiInstance = new DocumentsApi();
String id = id_example; // String | Unique identifier of the document.
try {
apiInstance.deleteDocument(id);
} catch (ApiException e) {
System.err.println("Exception when calling DocumentsApi#deleteDocument");
e.printStackTrace();
}
}
}
import 'package:openapi/api.dart';
final api_instance = DefaultApi();
final String id = new String(); // String | Unique identifier of the document.
try {
final result = await api_instance.deleteDocument(id);
print(result);
} catch (e) {
print('Exception when calling DefaultApi->deleteDocument: $e\n');
}
import org.openapitools.client.api.DocumentsApi;
public class DocumentsApiExample {
public static void main(String[] args) {
DocumentsApi apiInstance = new DocumentsApi();
String id = id_example; // String | Unique identifier of the document.
try {
apiInstance.deleteDocument(id);
} catch (ApiException e) {
System.err.println("Exception when calling DocumentsApi#deleteDocument");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure Bearer (JWT) access token for authorization: bearer
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
// Create an instance of the API class
DocumentsApi *apiInstance = [[DocumentsApi alloc] init];
String *id = id_example; // Unique identifier of the document. (default to null)
// Deletes a document
[apiInstance deleteDocumentWith:id
completionHandler: ^(NSError* error) {
if (error) {
NSLog(@"Error: %@", error);
}
}];
var IruruetaResourceServerApi = require('irurueta_resource_server_api');
var defaultClient = IruruetaResourceServerApi.ApiClient.instance;
// Configure Bearer (JWT) access token for authorization: bearer
var bearer = defaultClient.authentications['bearer'];
bearer.accessToken = "YOUR ACCESS TOKEN";
// Create an instance of the API class
var api = new IruruetaResourceServerApi.DocumentsApi()
var id = id_example; // {String} Unique identifier of the document.
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
};
api.deleteDocument(id, callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class deleteDocumentExample
{
public void main()
{
// Configure Bearer (JWT) access token for authorization: bearer
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
// Create an instance of the API class
var apiInstance = new DocumentsApi();
var id = id_example; // String | Unique identifier of the document. (default to null)
try {
// Deletes a document
apiInstance.deleteDocument(id);
} catch (Exception e) {
Debug.Print("Exception when calling DocumentsApi.deleteDocument: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer (JWT) access token for authorization: bearer
OpenAPITools\Client\Configuration::getDefaultConfiguration()->setAccessToken('', 'YOUR_ACCESS_TOKEN');
// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DocumentsApi();
$id = id_example; // String | Unique identifier of the document.
try {
$api_instance->deleteDocument($id);
} catch (Exception $e) {
echo 'Exception when calling DocumentsApi->deleteDocument: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::DocumentsApi;
# Configure Bearer (JWT) access token for authorization: bearer
$WWW::OPenAPIClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::DocumentsApi->new();
my $id = id_example; # String | Unique identifier of the document.
eval {
$api_instance->deleteDocument(id => $id);
};
if ($@) {
warn "Exception when calling DocumentsApi->deleteDocument: $@\n";
}
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Configure Bearer (JWT) access token for authorization: bearer
openapi_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Create an instance of the API class
api_instance = openapi_client.DocumentsApi()
id = id_example # String | Unique identifier of the document. (default to null)
try:
# Deletes a document
api_instance.delete_document(id)
except ApiException as e:
print("Exception when calling DocumentsApi->deleteDocument: %s\n" % e)
extern crate DocumentsApi;
pub fn main() {
let id = id_example; // String
let mut context = DocumentsApi::Context::default();
let result = client.deleteDocument(id, &context).wait();
println!("{:?}", result);
}
Scopes
| documents.delete | Access token issued by the authorization server for this resource server's audience: a JWT, or a reference token with the opaque profile. The scope an operation needs is listed as the role of its security requirement; an administrator (role ADMIN) acts on every document. Failures are answered with an RFC 6750 WWW-Authenticate challenge and no body. |
Parameters
Path parameters
| Name | Description |
|---|---|
| id* |
String
Unique identifier of the document.
Required
|
Responses
| Name | Type | Format | Description |
|---|---|---|---|
| WWW-Authenticate | String |
| Name | Type | Format | Description |
|---|---|---|---|
| WWW-Authenticate | String |