deleteDocument
Deletes a document
Deletes one of the signed-in user's documents; an administrator may delete any. The BFF asks the resource server (DELETE /api/documents/{id} there, which needs the scope documents.delete and a recent strong authentication) with the access token of the session. Someone else's document is answered 404, like a missing one. A state-changing request: it needs the CSRF token.
/api/documents/{id}
Usage and SDK Samples
curl -X DELETE \
\
-H "X-XSRF-TOKEN: [[apiKey]]" \
-H "Accept: application/problem+json,application/json" \
"http://localhost:8080/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 API key authorization: session
ApiKeyAuth session = (ApiKeyAuth) defaultClient.getAuthentication("session");
session.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//session.setApiKeyPrefix("Token");
// Configure API key authorization: csrf
ApiKeyAuth csrf = (ApiKeyAuth) defaultClient.getAuthentication("csrf");
csrf.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//csrf.setApiKeyPrefix("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 API key authorization: (authentication scheme: session)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"__Host-SESSION"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"__Host-SESSION"];
// Configure API key authorization: (authentication scheme: csrf)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"X-XSRF-TOKEN"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"X-XSRF-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 IruruetaBffApi = require('irurueta_bff_api');
var defaultClient = IruruetaBffApi.ApiClient.instance;
// Configure API key authorization: session
var session = defaultClient.authentications['session'];
session.apiKey = "YOUR API KEY";
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//session.apiKeyPrefix['__Host-SESSION'] = "Token";
// Configure API key authorization: csrf
var csrf = defaultClient.authentications['csrf'];
csrf.apiKey = "YOUR API KEY";
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//csrf.apiKeyPrefix['X-XSRF-TOKEN'] = "Token";
// Create an instance of the API class
var api = new IruruetaBffApi.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 API key authorization: session
Configuration.Default.ApiKey.Add("__Host-SESSION", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("__Host-SESSION", "Bearer");
// Configure API key authorization: csrf
Configuration.Default.ApiKey.Add("X-XSRF-TOKEN", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("X-XSRF-TOKEN", "Bearer");
// 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 API key authorization: session
OpenAPITools\Client\Configuration::getDefaultConfiguration()->setApiKey('__Host-SESSION', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// OpenAPITools\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('__Host-SESSION', 'Bearer');
// Configure API key authorization: csrf
OpenAPITools\Client\Configuration::getDefaultConfiguration()->setApiKey('X-XSRF-TOKEN', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// OpenAPITools\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-XSRF-TOKEN', 'Bearer');
// 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 API key authorization: session
$WWW::OPenAPIClient::Configuration::api_key->{'__Host-SESSION'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::OPenAPIClient::Configuration::api_key_prefix->{'__Host-SESSION'} = "Bearer";
# Configure API key authorization: csrf
$WWW::OPenAPIClient::Configuration::api_key->{'X-XSRF-TOKEN'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::OPenAPIClient::Configuration::api_key_prefix->{'X-XSRF-TOKEN'} = "Bearer";
# 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 API key authorization: session
openapi_client.configuration.api_key['__Host-SESSION'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# openapi_client.configuration.api_key_prefix['__Host-SESSION'] = 'Bearer'
# Configure API key authorization: csrf
openapi_client.configuration.api_key['X-XSRF-TOKEN'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# openapi_client.configuration.api_key_prefix['X-XSRF-TOKEN'] = 'Bearer'
# 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
Parameters
| Name | Description |
|---|---|
| id* |
String
Unique identifier of the document.
Required
|