Remove This REST API removes all Field
items.
Usage examples with cURL and Postman
The following URIs are used to address REST resources:
Copy ~/{file-name}/fields
~/{file-name}/{nodePath}/fields
, where:
{file-name} is a filename of a document.
{nodePath} is a path to a node in a document. If this parameter is used, elements contained within a specified node will be processed:
sections/{sectionIndex} - references a section.
paragraphs/{paragraphIndex} - references a paragraph.
sections/{sectionIndex}/paragraphs/{paragraphIndex} - references a paragraph within a section.
Important properties are the following:
Property Name
Type
Description
FieldCode
string
Returns field code.
LocaleId
int
Gets or sets LCID of the field.
Result
string
Returns field result.
You can carry out REST API interactions using cURL
and Postman
. Please read these instructions to receive a personal JWT_TOKEN
for authorization.
Download sample GetField.docx file for testing purposes.
cURL Request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -v "https://api.aspose.cloud/v4.0/words/online/delete/{nodePath}/fields" \
-X PUT \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer ####################" \
-F Document="@Sample.docx"
To get a JWT token use this instruction
Postman Request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{
"info": {
"name": "DeleteFieldsOnline",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "clientSecret",
"value": "{{CLIENT_SECRET}}",
"type": "string"
},
{
"key": "clientId",
"value": "{{CLIENT_ID}}",
"type": "string"
},
{
"key": "addTokenTo",
"value": "header",
"type": "string"
},
{
"key": "client_authentication",
"value": "body",
"type": "string"
},
{
"key": "accessTokenUrl",
"value": "https://api.aspose.cloud/connect/token",
"type": "string"
},
{
"key": "grant_type",
"value": "client_credentials",
"type": "string"
},
{
"key": "tokenName",
"value": "Access Token",
"type": "string"
}
]
},
"item": [
{
"name": "deleteRequest",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "PUT",
"header": [
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "Document",
"type": "file",
"src": "Sample.docx"
}
]
},
"url": {
"raw": "https://api.aspose.cloud/v4.0/words/online/delete/{nodePath}/fields",
"protocol": "https",
"host": [
"api",
"aspose",
"cloud"
],
"path": [
"v4.0",
"words",
"online",
"delete",
"{nodePath}",
"fields"
],
"query": [
]
}
},
"response": []
}
],
"variable": [
]
}
To get a JWT token use this instruction
Server Response
Copy {
"Code" : 200 ,
"Status" : "OK"
}
Aspose.Words Cloud SDK Family
Using SDK is the best way to speed up the development. Please go to the GitHub repository to explore a wide family of our Cloud SDKs. These powerful libraries take care of all low-level programming details and let you focus on your primary tasks.
Usage examples in Python, Java, C#, etc.
The following code samples show how to interact with the REST API using almost any mainstream programming language.
You can find a lot of other examples in Python , Java , C# , JavaScript , PHP , C++ , Golang , Ruby , Swift , Dart on GitHub. All codes are thoroughly tested and ready for production use.
Case 1 : Delete Fields from a Document
Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os
import asposewordscloud
import asposewordscloud.models.requests
from asposewordscloud.rest import ApiException
from shutil import copyfile
words_api = WordsApi(client_id = '####-####-####-####-####', client_secret = '##################')
request_document = open('Sample.docx', 'rb')
delete_request = asposewordscloud.models.requests.DeleteFieldsOnlineRequest(document=request_document)
words_api.delete_fields_online(delete_request)
Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.aspose.words.cloud.*;
import com.aspose.words.cloud.api.*;
import com.aspose.words.cloud.model.*;
import com.aspose.words.cloud.model.requests.*;
import com.aspose.words.cloud.model.responses.*;
import java.nio.file.Files;
import java.nio.file.Paths;
ApiClient apiClient = new ApiClient(/*clientId*/ "####-####-####-####-####", /*clientSecret*/ "##################", null);
WordsApi wordsApi = new WordsApi(apiClient);
byte[] requestDocument = Files.readAllBytes(Paths.get("Sample.docx").toAbsolutePath());
DeleteFieldsOnlineRequest deleteRequest = new DeleteFieldsOnlineRequest(requestDocument, null, null, null, null, null, null, null);
wordsApi.deleteFieldsOnline(deleteRequest);
Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as fs from "fs";
const clientId = "####-####-####-####-####";
const secret = "##################";
const wordsApi = new WordsApi(clientId, secret);
const requestDocument = fs.createReadStream("Sample.docx");
const deleteRequest = new model.DeleteFieldsOnlineRequest({
document: requestDocument
});
wordsApi.deleteFieldsOnline(deleteRequest)
.then((deleteRequestResult) => {
// tslint:disable-next-line:no-console
console.log("Result of deleteRequest: ", deleteRequestResult);
});
C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Aspose.Words.Cloud.Sdk;
using Aspose.Words.Cloud.Sdk.Model;
using Aspose.Words.Cloud.Sdk.Model.Requests;
var config = new Configuration { ClientId = "####-####-####-####-####", ClientSecret = "##################" };
var wordsApi = new WordsApi(config);
using var requestDocument = File.OpenRead("Sample.docx");
var deleteRequest = new DeleteFieldsOnlineRequest(requestDocument);
await wordsApi.DeleteFieldsOnline(deleteRequest);
PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php
use Aspose\Words\WordsApi;
use Aspose\Words\Model\Requests\{DeleteFieldsOnlineRequest};
$clientId = '####-####-####-####-####';
$secret = '##################';
$wordsApi = new WordsApi($clientId, $secret);
$requestDocument = "Sample.docx";
$deleteRequest = new DeleteFieldsOnlineRequest(
$requestDocument, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
$wordsApi->deleteFieldsOnline($deleteRequest);
C++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include " aspose_words_cloud.h"
using namespace aspose ::words::cloud;
auto config = std::make_shared<ApiConfiguration>(/* clientId*/ L" ####-####-####-####-####" , /* clientSecret*/ L" ##################" );
auto wordsApi = std::make_shared<WordsApi>(config);
auto requestDocument = std::shared_ptr<std::istream>(new std::ifstream(std::filesystem::path(L" Sample.docx" ), std::istream::binary));
std::shared_ptr<requests::DeleteFieldsOnlineRequest> deleteRequest (
new requests::DeleteFieldsOnlineRequest(
requestDocument));
wordsApi->deleteFieldsOnline (deleteRequest);
Go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{
"ClientId" : " ####-####-####-####-####" ,
"ClientSecret" : " ##################" ,
"BaseUrl" : " https://api.aspose.cloud"
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import (
"os"
"github.com/aspose-words-cloud/aspose-words-cloud-go/dev/api/models")
config, _ := models.NewConfiguration("config.json")
wordsApi, ctx, _ := api.CreateWordsApi(config)
requestDocument, _ := os.Open("Sample.docx")
deleteRequestOptions := map[string]interface{}{}
deleteRequest := &models.DeleteFieldsOnlineRequest{
Document: requestDocument,
Optionals: deleteRequestOptions,
}
_, _, _ = wordsApi.DeleteFieldsOnline(ctx, deleteRequest)
Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'aspose_words_cloud'
AsposeWordsCloud.configure do |config|
config.client_data['ClientId'] = '####-####-####-####-####'
config.client_data['ClientSecret'] = '##################'
end
@words_api = WordsAPI.new
request_document = File.open('Sample.docx')
delete_request = DeleteFieldsOnlineRequest.new(document: request_document)
@words_api.delete_fields_online(delete_request)
Swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AsposeWordsCloud
let config = Configuration(clientId: "####-####-####-####-####", clientSecret: "##################");
let api = try WordsAPI(configuration: config);
let requestDocument = InputStream(url: URL(string: "Sample.docx"))!;
let deleteRequest = DeleteFieldsOnlineRequest(document: requestDocument);
_ = try api.deleteFieldsOnline(request: deleteRequest);
Dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:io';
import 'package:aspose_words_cloud/aspose_words_cloud.dart';
final clientId = "####-####-####-####-####";
final clientSecret = "##################";
final config = Configuration(clientId, clientSecret);
final wordsApi = WordsApi(config);
final requestDocument = (await File('Sample.docx').readAsBytes()).buffer.asByteData();
final deleteRequest = DeleteFieldsOnlineRequest(requestDocument);
await wordsApi.deleteFieldsOnline(deleteRequest);
Case 2 : Delete Fields from a Section
Case 3 : Delete Fields from a Paragraph