Aggiorna metadati Questo REST API indica di aggiornare metadata
da più file Excel.
RSET API
Copy
POST http://api.aspose.cloud/v3.0/cells/metadata/update
I parametri della richiesta sono:
Nome del parametro
Tipo
Percorso/Stringa di query/Corpo HTTP
Descrizione
file
file
formData
File da caricare
Proprietà del documento
corpo
Cells proprietà del documento.
ILSpecifiche OpenAPI definisce un’interfaccia di programmazione accessibile al pubblico e consente di eseguire interazioni REST direttamente da un browser web.
È possibile utilizzare lo strumento da riga di comando cURL per accedere facilmente ai servizi web Aspose.Cells. L’esempio seguente mostra come effettuare chiamate al Cloud API con cURL.
Famiglia Cloud SDK
Utilizzare un SDK è il modo migliore per accelerare lo sviluppo. Un SDK si occupa dei dettagli di basso livello e ti consente di concentrarti sulle attività del progetto. Dai un’occhiata aRepository GitHub per un elenco completo di Aspose.Cells Cloud SDK.
I seguenti esempi di codice mostrano come effettuare chiamate ai servizi Web Aspose.Cells utilizzando vari SDK:
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
namespace Aspose.Cells.Cloud.SDK.Tests.Api.Example
{
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Aspose.Cells.Cloud.SDK.Request;
using System.Collections.Generic;
using Aspose.Cells.Cloud.SDK.Api;
using System;
using System.IO;
[TestClass]
public class CellsApiExample
{
string CellsCloudClientId ="....";//get from https://dashboard.aspose.cloud/#/applications
string CellsCloudClientSecret="...";//get from https://dashboard.aspose.cloud/#/applications
string localName = "Book1.xlsx";
string localPath = "D:/TestData/CellsCloud";
[TestCategory("Cells")]
[TestMethod]
public void GetWorksheetAutoFilter()
{
IDictionary<string, Stream> mapFiles = new Dictionary<string, Stream>();
mapFiles.Add(localName, File.OpenRead(localPath +"/"+ localName));
var cellsDocumentscellsDocument0 = new CellsDocumentProperty()
{
Name = "Author",
Value = "roy.wang"
};
var cellsDocuments = new List<CellsDocumentProperty>()
{
cellsDocumentscellsDocument0
};
var request = new PostMetadataRequest(
file: mapFiles,
cellsDocuments: cellsDocuments
);
cellsApi.PostMetadata(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
package com.aspose.cloud.cells.api;
import com.aspose.cloud.cells.client.*;
import com.aspose.cloud.cells.model.*;
import com.aspose.cloud.cells.request.*;
import java.io.IOException;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import java.io.File;
import java.util.HashMap;
public class Example {
private CellsApi api;
public Example(){
try {
api = new CellsApi(
System.getenv("CellsCloudClientId"),
System.getenv("CellsCloudClientSecret"),
"v3.0",
System.getenv("CellsCloudApiBaseUrl")
);
} catch (ApiException e) {
e.printStackTrace();
}
}
public void Run(){
try{
String book1Xlsx = "Book1.xlsx";
PostMetadataRequest request = new PostMetadataRequest();
ArrayList<CellsDocumentProperty> cellsDocuments = new ArrayList<CellsDocumentProperty>();
CellsDocumentProperty cellsDocument = new CellsDocumentProperty();
cellsDocument.setName("Author");
cellsDocument.setValue("roy.wang");
cellsDocuments.add(cellsDocument);
request.setCellsDocuments(cellsDocuments);
HashMap<String,File> fileMap = new HashMap<String,File>();
fileMap.put(book1Xlsx ,CellsApiUtil.GetFileHolder(book1Xlsx) );
request.setFile(fileMap);
this.api.postMetadata(request);
} catch (ApiException e) {
e.printStackTrace();
}catch (IOException e) {
e.printStackTrace();
}
}
}
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
require_once('vendor\autoload.php');
use \Aspose\Cells\Cloud\Api\CellsApi;
use \Aspose\Cells\Cloud\Request\PostMetadataRequest;
$CellsCloudClientId = "...." ; # get from https://dashboard.aspose.cloud/#/applications
$CellsCloudClientSecret = "...."; # get from https://dashboard.aspose.cloud/#/applications
$cellsApi = new CellsApi($CellsCloudClientId , $CellsCloudClientSecret );
$book1Xlsx = "Book1.xlsx";
$mapFiles = array ();
$cellsDocumentscellsDocument0 = new \Aspose\Cells\Cloud\Model\CellsDocumentProperty();
$cellsDocumentscellsDocument0->setName("Author" );
$cellsDocumentscellsDocument0->setValue("roy.wang" );
$cellsDocuments = array (
$cellsDocumentscellsDocument0
);
$mapFiles[$book1Xlsx] ='TestData/'.$book1Xlsx;
$request = new PostMetadataRequest();
$request->setFile( $mapFiles);
$request->setCellsDocuments( $cellsDocuments);
$cellsApi->postMetadata($request);
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 'openssl'
require 'bundler'
require 'aspose_cells_cloud'
CellsCloudClientId = "...." # get from https://dashboard.aspose.cloud/#/applications
CellsCloudClientSecret = "...." # get from https://dashboard.aspose.cloud/#/applications
@instance = AsposeCellsCloud::CellsApi.new(CellsCloudClientId, CellsCloudClientSecret)
book1_xlsx = 'Book1.xlsx'
mapFiles = { }
cellsDocumentscellsDocument0 = AsposeCellsCloud::CellsDocumentProperty.new(:Name=>'Author' ,:Value=>'roy.wang' );
cellsDocuments = [
cellsDocumentscellsDocument0
];
mapFiles[book1_xlsx]= ::File.open(File.expand_path("TestData/"+book1_xlsx),"r")
request = AsposeCellsCloud::PostMetadataRequest.new(:File=>mapFiles,:cellsDocuments=>cellsDocuments);
@instance.post_metadata(request);
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 { CellsApi,PostMetadataRequest,CellsDocumentProperty,CellsDocumentProperty,UploadFileRequest } from "asposecellscloud";
var fs = require('fs');
var path = require('path');
var process = require('process');
const _ = require('asposecellscloud');
const CellsCloudClientId ="....";//get from https://dashboard.aspose.cloud/#/applications
const CellsCloudClientSecret="...";//get from https://dashboard.aspose.cloud/#/applications
const cellsApi = new CellsApi(CellsCloudClientId, CellsCloudClientSecret);
var remoteFolder = "TestData/In"
var localPath = "TestData/CellsCloud/"
var localName = "Book1.xlsx"
var remoteName = "Book1.xlsx"
describe('example', function(){
it("should call successfully" , function(){
var mapFiles = {};
var cellsDocumentscellsDocument0 = new CellsDocumentProperty();
cellsDocumentscellsDocument0.name = "Author" ;
cellsDocumentscellsDocument0.value = "roy.wang" ;
var cellsDocuments = new Array<CellsDocumentProperty>();cellsDocuments.push(cellsDocumentscellsDocument0);
mapFiles[book1Xlsx]= fs.createReadStream(localPath +localName) ;
var request = new PostMetadataRequest();
request.file = mapFiles;
request.cellsDocuments = cellsDocuments;
return cellsApi.postMetadata(request)
});
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 sys
from asposecellscloud.apis.cells_api import CellsApi
from asposecellscloud.models import *
from asposecellscloud.requests import *
CellsCloudClientId ='....' # get from https://dashboard.aspose.cloud/#/applications
CellsCloudClientSecret='....' # get from https://dashboard.aspose.cloud/#/applications
api = CellsApi(CellsCloudClientId,CellsCloudClientSecret)
cellsDocumentscellsDocument0 = CellsDocumentProperty(name= 'Author' ,value= 'roy.wang' )
cellsDocuments = [ cellsDocumentscellsDocument0 ]
request = PostMetadataRequest( {'assemblytest.xlsx':'assemblytest.xlsx'}, cellsDocuments)
api.post_metadata(request)
Perl
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
use lib 'lib';
use strict;
use warnings;
use File::Slurp;
use MIME::Base64;
use AsposeCellsCloud::CellsApi;
my $CellsCloudClientId = "...."; # get from https://dashboard.aspose.cloud/#/applications
my $CellsCloudClientSecret = "...."; # get from https://dashboard.aspose.cloud/#/applications
my $config = AsposeCellsCloud::Configuration->new( client_id => $CellsCloudClientId , client_secret => $CellsCloudClientSecret );
my $instance = AsposeCellsCloud::CellsApi->new(AsposeCellsCloud::ApiClient->new( $config));
my $book1Xlsx = 'Book1.xlsx';
my $mapFiles = {};
my $cells_documentscells_document0 = AsposeCellsCloud::Object::CellsDocumentProperty->new();
$cells_documentscells_document0->{name} = 'Author' ;
$cells_documentscells_document0->{value} = 'roy.wang' ;
my @cells_documents = [];push (@cells_documents ,$cells_documentscells_document0 );
$mapFiles->{$book1Xlsx}= "TestData/".$book1Xlsx ;
my $request = AsposeCellsCloud::Request::PostMetadataRequest->new();
$request->{file} = $mapFiles;
$request->{cells_documents} = []; push ( @{$request->{cells_documents}}, $cells_documentscells_document0 );;
$instance->post_metadata(request=> $request);
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
package main
import (
. "github.com/aspose-cells-cloud/aspose-cells-cloud-go/v25"
)
func main() {
CellsCloudClientId := "...." // get from https://dashboard.aspose.cloud/#/applications
CellsCloudClientSecret := "...." // get from https://dashboard.aspose.cloud/#/applications
instance := NewCellsApiService(CellsCloudClientId, CellsCloudClientSecret)
book1Xlsx := "Book1.xlsx"
var mapFiles map[string]string
mapFiles = make(map[string]string)
var cellsDocumentscellsDocument0 = new(CellsDocumentProperty)
cellsDocumentscellsDocument0.Name = "Author"
cellsDocumentscellsDocument0.Value = "roy.wang"
var cellsDocuments = []CellsDocumentProperty{*cellsDocumentscellsDocument0}
mapFiles[book1Xlsx] = book1Xlsx
request := new(PostMetadataRequest)
request.File = mapFiles
request.CellsDocuments = cellsDocuments
_, httpResponse, err := instance.PostMetadata(request)
if err != nil {
println(err.Error())
} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
println("Fail")
}
}