Download a web page and save it in the specified format Downloads a web page and saves it in the specified document format.
Download a Web page and save it in the specified document format REST API
Server
Method
Endpoint
https://api.aspose.cloud/v4.0
PUT
/words/loadWebDocument
You can use the following parameters in a REST request:
Parameter Name
Data Type
Required/Optional
Description
storage
string
Optional
Original document storage.
‘application/json’ Encoding
Property Name
Data Type
Required/Optional
Description
‘application/xml’ Encoding
Property Name
Data Type
Required/Optional
Description
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.
Download a Web page and save it in the specified document format 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 download a Web page and save it in the specified document format 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 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/loadWebDocument" \
-X PUT \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ####################" \
-d "{\"LoadingDocumentUrl\":\"http://google.com\",\"SaveOptions\":{\"FileName\":\"google.doc\",\"DmlEffectsRenderingMode\":\"None\",\"DmlRenderingMode\":\"DrawingML\",\"UpdateSdtContent\":false,\"ZipOutput\":false}}"
To get a JWT token use these instructions
Postman Request
This file contains 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": "LoadWebDocument",
"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": "loadRequest",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "PUT",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\"LoadingDocumentUrl\":\"http://google.com\",\"SaveOptions\":{\"FileName\":\"google.doc\",\"DmlEffectsRenderingMode\":\"None\",\"DmlRenderingMode\":\"DrawingML\",\"UpdateSdtContent\":false,\"ZipOutput\":false}}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api.aspose.cloud/v4.0/words/loadWebDocument",
"protocol": "https",
"host": [
"api",
"aspose",
"cloud"
],
"path": [
"v4.0",
"words",
"loadWebDocument"
],
"query": [
]
}
},
"response": []
}
],
"variable": [
]
}
To get a JWT token use these instructions
How to download a Web page and save it in the specified document format 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 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_data_save_options = asposewordscloud.DocSaveOptionsData(file_name='google.doc', dml_effects_rendering_mode='None', dml_rendering_mode='DrawingML', update_sdt_content=False, zip_output=False)
request_data = asposewordscloud.LoadWebDocumentData(loading_document_url='http://google.com', save_options=request_data_save_options)
load_request = asposewordscloud.models.requests.LoadWebDocumentRequest(data=request_data)
words_api.load_web_document(load_request)
Java
This file contains 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);
DocSaveOptionsData requestDataSaveOptions = new DocSaveOptionsData();
requestDataSaveOptions.setFileName("google.doc");
requestDataSaveOptions.setDmlEffectsRenderingMode(DocSaveOptionsData.DmlEffectsRenderingModeEnum.NONE);
requestDataSaveOptions.setDmlRenderingMode(DocSaveOptionsData.DmlRenderingModeEnum.DRAWINGML);
requestDataSaveOptions.setUpdateSdtContent(false);
requestDataSaveOptions.setZipOutput(false);
LoadWebDocumentData requestData = new LoadWebDocumentData();
requestData.setLoadingDocumentUrl("http://google.com");
requestData.setSaveOptions(requestDataSaveOptions);
LoadWebDocumentRequest loadRequest = new LoadWebDocumentRequest(requestData, null);
wordsApi.loadWebDocument(loadRequest);
Node.js
This file contains 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 requestDataSaveOptions = new model.DocSaveOptionsData({
fileName: "google.doc",
dmlEffectsRenderingMode: model.DocSaveOptionsData.DmlEffectsRenderingModeEnum.None,
dmlRenderingMode: model.DocSaveOptionsData.DmlRenderingModeEnum.DrawingML,
updateSdtContent: false,
zipOutput: false
})
const requestData = new model.LoadWebDocumentData({
loadingDocumentUrl: "http://google.com",
saveOptions: requestDataSaveOptions
})
const loadRequest = new model.LoadWebDocumentRequest({
data: requestData
});
wordsApi.loadWebDocument(loadRequest)
.then((loadRequestResult) => {
// tslint:disable-next-line:no-console
console.log("Result of loadRequest: ", loadRequestResult);
});
C#
This file contains 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);
var requestDataSaveOptions = new DocSaveOptionsData()
{
FileName = "google.doc",
DmlEffectsRenderingMode = DocSaveOptionsData.DmlEffectsRenderingModeEnum.None,
DmlRenderingMode = DocSaveOptionsData.DmlRenderingModeEnum.DrawingML,
UpdateSdtContent = false,
ZipOutput = false
};
var requestData = new LoadWebDocumentData()
{
LoadingDocumentUrl = "http://google.com",
SaveOptions = requestDataSaveOptions
};
var loadRequest = new LoadWebDocumentRequest(requestData);
await wordsApi.LoadWebDocument(loadRequest);
PHP
This file contains 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\{LoadWebDocumentRequest};
use Aspose\Words\Model\{DocSaveOptionsData, LoadWebDocumentData};
$clientId = '####-####-####-####-####';
$secret = '##################';
$wordsApi = new WordsApi($clientId, $secret);
$requestDataSaveOptions = new DocSaveOptionsData(array(
"file_name" => "google.doc",
"dml_effects_rendering_mode" => "None",
"dml_rendering_mode" => "DrawingML",
"update_sdt_content" => false,
"zip_output" => false,));
$requestData = new LoadWebDocumentData(array(
"loading_document_url" => "http://google.com",
"save_options" => $requestDataSaveOptions,));
$loadRequest = new LoadWebDocumentRequest(
$requestData, NULL);
$wordsApi->loadWebDocument($loadRequest);
C++
This file contains 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 requestDataSaveOptions = std::make_shared<aspose::words::cloud::models::DocSaveOptionsData>();
requestDataSaveOptions->setFileName(std::make_shared<std::wstring>(L"google.doc"));
requestDataSaveOptions->setDmlEffectsRenderingMode(std::make_shared<aspose::words::cloud::models::SaveOptionsData::DmlEffectsRenderingMode>(aspose::words::cloud::models::SaveOptionsData::DmlEffectsRenderingMode::NONE));
requestDataSaveOptions->setDmlRenderingMode(std::make_shared<aspose::words::cloud::models::SaveOptionsData::DmlRenderingMode>(aspose::words::cloud::models::SaveOptionsData::DmlRenderingMode::DRAWING_ML));
requestDataSaveOptions->setUpdateSdtContent(std::make_shared<bool>(false));
requestDataSaveOptions->setZipOutput(std::make_shared<bool>(false));
auto requestData = std::make_shared<aspose::words::cloud::models::LoadWebDocumentData>();
requestData->setLoadingDocumentUrl(std::make_shared<std::wstring>(L"http://google.com"));
requestData->setSaveOptions(requestDataSaveOptions);
std::shared_ptr<requests::LoadWebDocumentRequest> loadRequest(
new requests::LoadWebDocumentRequest(
requestData));
wordsApi->loadWebDocument(loadRequest);
Go
This file contains 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 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)
requestDataSaveOptions := models.DocSaveOptionsData{
FileName: ToStringPointer("google.doc"),
DmlEffectsRenderingMode: ToStringPointer("None"),
DmlRenderingMode: ToStringPointer("DrawingML"),
UpdateSdtContent: ToBoolPointer(false),
ZipOutput: ToBoolPointer(false),
}
requestData := models.LoadWebDocumentData{
LoadingDocumentUrl: ToStringPointer("http://google.com"),
SaveOptions: &requestDataSaveOptions,
}
loadRequestOptions := map[string]interface{}{}
loadRequest := &models.LoadWebDocumentRequest{
Data: &requestData,
Optionals: loadRequestOptions,
}
_, _, _ = wordsApi.LoadWebDocument(ctx, loadRequest)
Ruby
This file contains 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_data_save_options = DocSaveOptionsData.new({:FileName => 'google.doc', :DmlEffectsRenderingMode => 'None', :DmlRenderingMode => 'DrawingML', :UpdateSdtContent => false, :ZipOutput => false})
request_data = LoadWebDocumentData.new({:LoadingDocumentUrl => 'http://google.com', :SaveOptions => request_data_save_options})
load_request = LoadWebDocumentRequest.new(data: request_data)
@words_api.load_web_document(load_request)
Swift
This file contains 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 requestDataSaveOptions = DocSaveOptionsData()
.setDmlEffectsRenderingMode(dmlEffectsRenderingMode: DocSaveOptionsData.DmlEffectsRenderingMode._none)
.setDmlRenderingMode(dmlRenderingMode: DocSaveOptionsData.DmlRenderingMode.drawingML)
.setFileName(fileName: "google.doc")
.setUpdateSdtContent(updateSdtContent: false)
.setZipOutput(zipOutput: false);
let requestData = LoadWebDocumentData()
.setLoadingDocumentUrl(loadingDocumentUrl: "http://google.com")
.setSaveOptions(saveOptions: requestDataSaveOptions as! DocSaveOptionsData);
let loadRequest = LoadWebDocumentRequest(data: requestData);
_ = try api.loadWebDocument(request: loadRequest);
Dart
This file contains 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 requestDataSaveOptions = DocSaveOptionsData();
requestDataSaveOptions.fileName = 'google.doc';
requestDataSaveOptions.dmlEffectsRenderingMode = SaveOptionsData_DmlEffectsRenderingModeEnum.none;
requestDataSaveOptions.dmlRenderingMode = SaveOptionsData_DmlRenderingModeEnum.drawingML;
requestDataSaveOptions.updateSdtContent = false;
requestDataSaveOptions.zipOutput = false;
final requestData = LoadWebDocumentData();
requestData.loadingDocumentUrl = 'http://google.com';
requestData.saveOptions = requestDataSaveOptions;
final loadRequest = LoadWebDocumentRequest(requestData);
await wordsApi.loadWebDocument(loadRequest);
See Also
GitHub repository — explore Aspose.Words Cloud SDK Family. These software libraries take care of all low-level document-processing details.