Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
Huawei Cloud Astro Canvas
Huawei Cloud Astro Zero
CodeArts Governance
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance (CCI)
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Cloud Transformation
Well-Architected Framework
Cloud Adoption Framework
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Sharing Token

Updated on 2025-03-21 GMT+08:00

You can call this API (described in Obtaining a Sharing Token) to obtain a temporary token. You can use this temporary token to access the file without using the access-token for authentication.

To share a token, perform the following steps:

  1. Obtaining a Sharing Token: obtains a temporary token.
  2. Viewing a Shared Object File: Use a temporary token to access the file.

Obtaining a Sharing Token

  • Function

    Used to obtain a temporary token. You can use this token to access files without using the access-token for authentication. The obtained token is temporary and has a validity period.

  • URI

    POST Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/{connector_type}/{connector_name}/sharetoken

    Table 1 URI parameters

    Parameter

    Mandatory

    Type

    Description

    connector_type

    Yes

    String

    Explanation

    Type of a connector.

    Constraints

    None

    Value

    • obs: connector for interconnecting with OBS.
    • minio: connector for connecting to MINIO.
    • objectstorageproxy: object storage proxy type.

    Default value

    None

    connector_name

    Yes

    String

    Explanation

    Name of the connector instance, that is, the connector instance name set when the connector is created.

    Constraints

    None

    Value

    None

    Default value

    None

  • Request Parameters
    Table 2 Request body parameters

    Parameter

    Mandatory

    Type

    Description

    shareType

    Yes

    Integer

    Explanation

    Sharing type.

    Constraints

    None

    Value

    • 0: sharing by file.
    • 1: sharing by directory.
    • 2: Use character arrays to indicate multiple file paths.

    Default value

    None

    key

    No

    String

    Explanation

    Shared objects and directories.

    Constraints

    If the value is a directory, it must end with /.

    Value

    None

    Default value

    None

    keys

    No

    String

    Explanation

    Multiple file paths.

    Constraints

    None

    Value

    None

    Default value

    None

    timeoutInMinutes

    Yes

    Integer

    Explanation

    Validity period of the sharing, in minutes.

    Constraints

    None

    Value

    1 to 1440, that is, 1 minute to 24 hours.

    Default value

    None

  • Response Parameters
    Table 3 Response parameters

    Parameter

    Type

    Description

    resCode

    String

    Explanation

    Return code.

    Value

    If the request is successful, 0 is returned. For details about other error codes, see Error Codes.

    resMsg

    String

    Explanation

    Message returned.

    Value

    If the request is successful, Success is returned. In other cases, an error message is returned.

    result

    Object

    Explanation

    Returned result object. If the object contains the shareToken field, the token is a temporary token.

  • Example Request

    An OBS connector has been created. The connector instance name is Namespace __TestOBS. Call the following request to obtain a temporary access token for some files:

    POST https://Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/obs/Namespace __TestOBS/sharetoken
    
    {
    	"shareType": 0,
    	"key": "a/b/c/1.txt",
    	"keys": [
    		"a/b/c/2.txt",
    		"ROMAExchange.zip",
    		"some/dir/c.jpg"
    	],
    	"timeoutInMinutes": 60
    }

    Users can access the file after obtaining the URL. Therefore, do not share sensitive files.

  • Example Response
    {
    	"resCode": "0",
    	"resMsg": "Success",
    	"result": {
    		"shareToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJz***tOejj6NEo"
    	}
    }

    Record the value of shareToken for subsequent file access.

Viewing a Shared Object File

  • Function

    See Obtaining a Sharing Token to view the file based on the returned temporary token.

  • URI

    GET Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/objectstorage/viewshareobject?object=X&shareToken=Y

    Table 4 URI parameters

    Parameter

    Mandatory

    Type

    Description

    object

    Yes

    String

    Explanation

    Full path of the file in the bucket, including the file name.

    Constraints

    None

    Value

    None

    Default value

    None

    shareToken

    Yes

    String

    Explanation

    Temporary token returned in Obtaining a Sharing Token.

    Constraints

    None

    Value

    None

    Default value

    None

  • Request Parameters

    None

  • Response Parameters

    Only the file content is returned.

  • Example Request

    An OBS connector has been created. The connector instance name is Namespace __TestOBS. Call the following request to use the temporary access token to view the a/b/c/1.txt file in the bucket.

    GET https://Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/objectstorage/viewshareobject?object=a/b/c/1.txt&shareToken=eyJhbGciOiJIUzI1NiIsInR******W8FYgXTGTAtOejj6NEo
  • Example Response
    test

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback