Insert a bookmark This REST API inserts a new bookmark in a Word document.
Insert a bookmark into a Word document REST API   
Server 
Method 
Endpoint 
 
 
https://api.aspose.cloud/v4.0 
PUT 
/words/online/post/bookmarks 
 
 
You can use the following parameters in a REST request:
Parameter Name 
Data Type 
Required/Optional 
Description 
 
 
loadEncoding 
string 
Optional 
Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML. 
 
password 
string 
Optional 
Password of protected Word document. Use the parameter to pass a password via SDK. SDK encrypts it automatically. We don’t recommend to use the parameter to pass a plain password for direct call of API. 
 
encryptedPassword 
string 
Optional 
Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details. 
 
destFileName 
string 
Optional 
Result path of the document after the operation. If this parameter is omitted then result of the operation will be saved as the source document. 
 
revisionAuthor 
string 
Optional 
Initials of the author to use for revisions.If you set this parameter and then make some changes to the document programmatically, save the document and later open the document in MS Word you will see these changes as revisions. 
 
revisionDateTime 
string 
Optional 
The date and time to use for revisions. 
 
 
Use $multipart/form-data request to combine one or more properties into a single body:
Property Name 
Data Type 
Required/Optional 
Description 
 
 
document 
string(binary) 
Required 
The document. 
 
bookmark 
BookmarkInsert 
Required 
Bookmark to insert. 
 
 
Note : to access this REST API, you need to register and get personal credentials. Use the ‘
Quick Start ’ guide to go through the procedure in a couple of minutes.
 
Insert a bookmark into a Word document usage examples   
Let’s look at practical examples of using the web service. You can do this both with cURL and Postman utilities, and from your code in various programming languages: Python, Java, JavaScript, C#, PHP, C++, Go, Ruby, Swift, Dart.
How to insert a bookmark into a Word document with cURL or Postman   
One of the easiest and fastest ways to call a REST API is to use cURL or Postman:
    
  
       
      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/post/bookmarks" \ 
         
        
           
               -X PUT \ 
         
        
           
               -H "Content-Type: multipart/form-data" \ 
         
        
           
               -H "Authorization: Bearer ####################" \ 
         
        
           
               -F Document="@Sample.docx" \ 
         
        
           
               -F Bookmark="{\"StartRange\":{\"NodeId\":\"0.0.0.0\",\"Offset\":0},\"EndRange\":{\"NodeId\":\"0.0.0.0\",\"Offset\":0},\"Name\":\"new_bookmark\",\"Text\":\"Some text\"}" 
         
  
 
     
   
 
       
      
     
 
To get a JWT token use these instructions 
 
       
      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": "InsertBookmarkOnline", 
         
        
           
                  "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": "insertRequest", 
         
        
           
                      "protocolProfileBehavior": { 
         
        
           
                          "disableBodyPruning": true 
         
        
           
                      }, 
         
        
           
                      "request": { 
         
        
           
                          "method": "PUT", 
         
        
           
                          "header": [ 
         
        
           
                          ], 
         
        
           
                          "body": { 
         
        
           
                              "mode": "formdata", 
         
        
           
                              "formdata": [ 
         
        
           
                                  { 
         
        
           
                                      "key": "Document", 
         
        
           
                                      "type": "file", 
         
        
           
                                      "src": "Sample.docx" 
         
        
           
                                  }, 
         
        
           
                                  { 
         
        
           
                                      "key": "Bookmark", 
         
        
           
                                      "type": "text", 
         
        
           
                                      "value": "{\"StartRange\":{\"NodeId\":\"0.0.0.0\",\"Offset\":0},\"EndRange\":{\"NodeId\":\"0.0.0.0\",\"Offset\":0},\"Name\":\"new_bookmark\",\"Text\":\"Some text\"}" 
         
        
           
                                  } 
         
        
           
                              ] 
         
        
           
                          }, 
         
        
           
                          "url": { 
         
        
           
                              "raw": "https://api.aspose.cloud/v4.0/words/online/post/bookmarks", 
         
        
           
                              "protocol": "https", 
         
        
           
                              "host": [ 
         
        
           
                                  "api", 
         
        
           
                                  "aspose", 
         
        
           
                                  "cloud" 
         
        
           
                              ], 
         
        
           
                              "path": [ 
         
        
           
                                  "v4.0", 
         
        
           
                                  "words", 
         
        
           
                                  "online", 
         
        
           
                                  "post", 
         
        
           
                                  "bookmarks" 
         
        
           
                              ], 
         
        
           
                              "query": [ 
         
        
           
                              ] 
         
        
           
                          } 
         
        
           
                      }, 
         
        
           
                      "response": [] 
         
        
           
                  } 
         
        
           
              ], 
         
        
           
              "variable": [ 
         
        
           
              ] 
         
        
           
          } 
         
  
 
     
   
 
       
      
     
 
To get a JWT token use these instructions 
 
 
 
How to insert a bookmark into a Word document in Python, Java, C#, C++, JavaScript and other programming languages   
Using SDK is the quickest way to speed up the development. Please take a look at the provided code examples to quickly call this web service from your favourite programming language:
    
  
       
      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' ) 
         
        
           
          request_bookmark_start_range  =  asposewordscloud .NewDocumentPosition (node_id = '0.0.0.0' , offset = 0 ) 
         
        
           
          request_bookmark_end_range  =  asposewordscloud .NewDocumentPosition (node_id = '0.0.0.0' , offset = 0 ) 
         
        
           
          request_bookmark  =  asposewordscloud .BookmarkInsert (start_range = request_bookmark_start_range , end_range = request_bookmark_end_range , name = 'new_bookmark' , text = 'Some text' ) 
         
        
           
          insert_request  =  asposewordscloud .models .requests .InsertBookmarkOnlineRequest (document = request_document , bookmark = request_bookmark ) 
         
        
           
          words_api .insert_bookmark_online (insert_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 ()); 
         
        
           
          NewDocumentPosition  requestBookmarkStartRange  = new  NewDocumentPosition (); 
         
        
           
          requestBookmarkStartRange .setNodeId ("0.0.0.0" ); 
         
        
           
          requestBookmarkStartRange .setOffset (0 ); 
         
        
           
          
 
         
        
           
          NewDocumentPosition  requestBookmarkEndRange  = new  NewDocumentPosition (); 
         
        
           
          requestBookmarkEndRange .setNodeId ("0.0.0.0" ); 
         
        
           
          requestBookmarkEndRange .setOffset (0 ); 
         
        
           
          
 
         
        
           
          BookmarkInsert  requestBookmark  = new  BookmarkInsert (); 
         
        
           
          requestBookmark .setStartRange (requestBookmarkStartRange ); 
         
        
           
          requestBookmark .setEndRange (requestBookmarkEndRange ); 
         
        
           
          requestBookmark .setName ("new_bookmark" ); 
         
        
           
          requestBookmark .setText ("Some text" ); 
         
        
           
          
 
         
        
           
          InsertBookmarkOnlineRequest  insertRequest  = new  InsertBookmarkOnlineRequest (requestDocument , requestBookmark , null , null , null , null , null , null ); 
         
        
           
          wordsApi .insertBookmarkOnline (insertRequest ); 
         
  
 
     
   
 
       
      
     
 
 
       
      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 requestBookmarkStartRange = new model.NewDocumentPosition({ 
         
        
           
              nodeId: "0.0.0.0", 
         
        
           
              offset: 0 
         
        
           
          }) 
         
        
           
          const requestBookmarkEndRange = new model.NewDocumentPosition({ 
         
        
           
              nodeId: "0.0.0.0", 
         
        
           
              offset: 0 
         
        
           
          }) 
         
        
           
          const requestBookmark = new model.BookmarkInsert({ 
         
        
           
              startRange: requestBookmarkStartRange, 
         
        
           
              endRange: requestBookmarkEndRange, 
         
        
           
              name: "new_bookmark", 
         
        
           
              text: "Some text" 
         
        
           
          }) 
         
        
           
          const insertRequest = new model.InsertBookmarkOnlineRequest({ 
         
        
           
              document: requestDocument, 
         
        
           
              bookmark: requestBookmark 
         
        
           
          }); 
         
        
           
          
 
         
        
           
          wordsApi.insertBookmarkOnline(insertRequest) 
         
        
           
          .then((insertRequestResult) => { 
         
        
           
              // tslint:disable-next-line:no-console 
         
        
           
              console.log("Result of insertRequest: ", insertRequestResult); 
         
        
           
          }); 
         
  
 
     
   
 
       
      
     
 
 
       
      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 requestBookmarkStartRange = new NewDocumentPosition() 
         
        
           
          { 
         
        
           
              NodeId = "0.0.0.0", 
         
        
           
              Offset = 0 
         
        
           
          }; 
         
        
           
          var requestBookmarkEndRange = new NewDocumentPosition() 
         
        
           
          { 
         
        
           
              NodeId = "0.0.0.0", 
         
        
           
              Offset = 0 
         
        
           
          }; 
         
        
           
          var requestBookmark = new BookmarkInsert() 
         
        
           
          { 
         
        
           
              StartRange = requestBookmarkStartRange, 
         
        
           
              EndRange = requestBookmarkEndRange, 
         
        
           
              Name = "new_bookmark", 
         
        
           
              Text = "Some text" 
         
        
           
          }; 
         
        
           
          var insertRequest = new InsertBookmarkOnlineRequest(requestDocument, requestBookmark); 
         
        
           
          await wordsApi.InsertBookmarkOnline(insertRequest); 
         
  
 
     
   
 
       
      
     
 
 
       
      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\{InsertBookmarkOnlineRequest}; 
         
        
           
          use Aspose\Words\Model\{BookmarkInsert, NewDocumentPosition}; 
         
        
           
          
 
         
        
           
          $clientId = '####-####-####-####-####'; 
         
        
           
          $secret = '##################'; 
         
        
           
          $wordsApi = new WordsApi($clientId, $secret); 
         
        
           
          $requestDocument = "Sample.docx"; 
         
        
           
          $requestBookmarkStartRange = new NewDocumentPosition(array( 
         
        
           
              "node_id" => "0.0.0.0", 
         
        
           
              "offset" => 0,)); 
         
        
           
          $requestBookmarkEndRange = new NewDocumentPosition(array( 
         
        
           
              "node_id" => "0.0.0.0", 
         
        
           
              "offset" => 0,)); 
         
        
           
          $requestBookmark = new BookmarkInsert(array( 
         
        
           
              "start_range" => $requestBookmarkStartRange, 
         
        
           
              "end_range" => $requestBookmarkEndRange, 
         
        
           
              "name" => "new_bookmark", 
         
        
           
              "text" => "Some text",)); 
         
        
           
          $insertRequest = new InsertBookmarkOnlineRequest( 
         
        
           
              $requestDocument, $requestBookmark, NULL, NULL, NULL, NULL, NULL, NULL); 
         
        
           
          $wordsApi->insertBookmarkOnline($insertRequest); 
         
  
 
     
   
 
       
      
     
 
 
       
      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)); 
         
        
           
          auto requestBookmarkStartRange = std::make_shared<aspose::words::cloud::models::NewDocumentPosition>(); 
         
        
           
          requestBookmarkStartRange->setNodeId(std::make_shared<std::wstring>(L"0.0.0.0")); 
         
        
           
          requestBookmarkStartRange->setOffset(std::make_shared<int32_t>(0)); 
         
        
           
          auto requestBookmarkEndRange = std::make_shared<aspose::words::cloud::models::NewDocumentPosition>(); 
         
        
           
          requestBookmarkEndRange->setNodeId(std::make_shared<std::wstring>(L"0.0.0.0")); 
         
        
           
          requestBookmarkEndRange->setOffset(std::make_shared<int32_t>(0)); 
         
        
           
          auto requestBookmark = std::make_shared<aspose::words::cloud::models::BookmarkInsert>(); 
         
        
           
          requestBookmark->setStartRange(requestBookmarkStartRange); 
         
        
           
          requestBookmark->setEndRange(requestBookmarkEndRange); 
         
        
           
          requestBookmark->setName(std::make_shared<std::wstring>(L"new_bookmark")); 
         
        
           
          requestBookmark->setText(std::make_shared<std::wstring>(L"Some text")); 
         
        
           
          std::shared_ptr<requests::InsertBookmarkOnlineRequest> insertRequest( 
         
        
           
              new requests::InsertBookmarkOnlineRequest( 
         
        
           
                  requestDocument, requestBookmark)); 
         
        
           
          wordsApi->insertBookmarkOnline(insertRequest); 
         
  
 
     
   
 
       
      
     
 
 
       
      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") 
         
        
           
          requestBookmarkStartRange := models.NewDocumentPosition{ 
         
        
           
              NodeId: ToStringPointer("0.0.0.0"), 
         
        
           
              Offset: ToInt32Pointer(int32(0)), 
         
        
           
          } 
         
        
           
          requestBookmarkEndRange := models.NewDocumentPosition{ 
         
        
           
              NodeId: ToStringPointer("0.0.0.0"), 
         
        
           
              Offset: ToInt32Pointer(int32(0)), 
         
        
           
          } 
         
        
           
          requestBookmark := models.BookmarkInsert{ 
         
        
           
              StartRange: &requestBookmarkStartRange, 
         
        
           
              EndRange: &requestBookmarkEndRange, 
         
        
           
              Name: ToStringPointer("new_bookmark"), 
         
        
           
              Text: ToStringPointer("Some text"), 
         
        
           
          } 
         
        
           
          insertRequestOptions := map[string]interface{}{} 
         
        
           
          insertRequest := &models.InsertBookmarkOnlineRequest{ 
         
        
           
              Document: requestDocument, 
         
        
           
              Bookmark: &requestBookmark, 
         
        
           
              Optionals: insertRequestOptions, 
         
        
           
          } 
         
        
           
          _, _, _ = wordsApi.InsertBookmarkOnline(ctx, insertRequest) 
         
  
 
     
   
 
       
      
     
 
 
       
      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' )  
         
        
           
          request_bookmark_start_range  =  NewDocumentPosition . new ( { :NodeId  =>  '0.0.0.0' ,  :Offset  =>  0 } )  
         
        
           
          request_bookmark_end_range  =  NewDocumentPosition . new ( { :NodeId  =>  '0.0.0.0' ,  :Offset  =>  0 } )  
         
        
           
          request_bookmark  =  BookmarkInsert . new ( { :StartRange  =>  request_bookmark_start_range ,  :EndRange  =>  request_bookmark_end_range ,  :Name  =>  'new_bookmark' ,  :Text  =>  'Some text' } )  
         
        
           
          insert_request  =  InsertBookmarkOnlineRequest . new ( document : request_document ,  bookmark : request_bookmark )  
         
        
           
          @words_api . insert_bookmark_online ( insert_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 requestBookmarkStartRange = NewDocumentPosition() 
         
        
           
            .setNodeId(nodeId: "0.0.0.0") 
         
        
           
            .setOffset(offset: 0); 
         
        
           
          let requestBookmarkEndRange = NewDocumentPosition() 
         
        
           
            .setNodeId(nodeId: "0.0.0.0") 
         
        
           
            .setOffset(offset: 0); 
         
        
           
          let requestBookmark = BookmarkInsert() 
         
        
           
            .setEndRange(endRange: requestBookmarkEndRange) 
         
        
           
            .setStartRange(startRange: requestBookmarkStartRange) 
         
        
           
            .setName(name: "new_bookmark") 
         
        
           
            .setText(text: "Some text"); 
         
        
           
          let insertRequest = InsertBookmarkOnlineRequest(document: requestDocument, bookmark: requestBookmark as! BookmarkInsert); 
         
        
           
          _ = try api.insertBookmarkOnline(request: insertRequest); 
         
  
 
     
   
 
       
      
     
 
 
       
      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 requestBookmarkStartRangeNode = NodeLink(); 
         
        
           
          requestBookmarkStartRangeNode.nodeId = '0.0.0.0'; 
         
        
           
          final requestBookmarkStartRange = DocumentPosition(); 
         
        
           
          requestBookmarkStartRange.node = requestBookmarkStartRangeNode; 
         
        
           
          final requestBookmarkEndRangeNode = NodeLink(); 
         
        
           
          requestBookmarkEndRangeNode.nodeId = '0.0.0.0'; 
         
        
           
          final requestBookmarkEndRange = DocumentPosition(); 
         
        
           
          requestBookmarkEndRange.node = requestBookmarkEndRangeNode; 
         
        
           
          final requestBookmark = BookmarkInsert(); 
         
        
           
          requestBookmark.startRange = requestBookmarkStartRange; 
         
        
           
          requestBookmark.endRange = requestBookmarkEndRange; 
         
        
           
          requestBookmark.name = 'new_bookmark'; 
         
        
           
          requestBookmark.text = 'Some text'; 
         
        
           
          final insertRequest = InsertBookmarkOnlineRequest(requestDocument, requestBookmark); 
         
        
           
          await wordsApi.insertBookmarkOnline(insertRequest); 
         
  
 
     
   
 
       
      
     
 
 
 
 
See Also   
GitHub repository  — explore Aspose.Words Cloud SDK Family. These software libraries take care of all low-level document-processing details.