Request

Response

    Reference Guide

    TypeScript SDK Reference for OSS

    Resource Information

    Package Name:
    @aps_sdk/oss
    Version:
    1.0.0

    Installing this Library

    npm i @aps_sdk/oss
    

    Learning Resources

    Source Code

    The source code for this library is available at https://github.com/autodesk-platform-services/aps-sdk-node.

    Tutorials

    The Simple Viewer tutorial on the https://tutorials.autodesk.io/ site illustrates how to use this library to store a model in a bucket. It also illustrates how to access the model for translation to the SVF2 format, so that the model can be displayed in a browser.

    Code Sample

    import { ObjectDetails, OssClient } from "@aps_sdk/oss";
    
    // Access token for authentication
    const ACCESS_TOKEN = "...";
    // Key for the bucket where the object will be stored
    const BUCKET_KEY = "...";
    // Key for the object to be uploaded
    const OBJECT_KEY = "...";
    // Source path or data of the object to be uploaded
    const FILEPATH_OR_BUFFER ="...";
    
    // Initialize the OSS Client
    const ossClient = new OssClient();
    
    // Upload the object to the specified bucket with the given object key and source
    const ObjectDetails = await ossClient.uploadObject(BUCKET_KEY, OBJECT_KEY, FILEPATH_OR_BUFFER, { accessToken: ACCESS_TOKEN});
    
    // Log the details of the uploaded object to the console
    console.log(objectDetails);
    
    Show More

    See https://github.com/autodesk-platform-services/aps-sdk-node/blob/main/samples/oss.ts for a complete code sample.


    SDK to REST API Cross Reference

    Operation CategoryOperationMethodHTTP Request

    Buckets

    Create Bucket createBucket POST /buckets
    List Buckets getBuckets GET /buckets
    Get Bucket Details getBucketDetails GET /buckets/{bucketKey}/details
    Delete Bucket deleteBucket DELETE /buckets/{bucketKey}

    Objects

    Delete Object deleteObject DELETE /buckets/{bucketKey}/objects/{objectKey}
    List Objects getObjects GET /buckets/{bucketKey}/objects
    Get Object Details getObjectDetails GET /buckets/{bucketKey}/objects/{objectKey}/details
    Generate OSS Signed URL createSignedResource POST /buckets/{bucketKey}/objects/{objectKey}/signed
    Download Object Using Signed URL getSignedResource GET /signedresources/hash
    Replace Object Using Signed URL uploadSignedResource PUT /signedresources/{hash}
    Delete Object Using Signed URL deleteSignedResource DELETE /signedresources/{hash}
    Upload Object Using Signed URL uploadSignedResourcesChunk PUT /signedresources/{hash}/resumable
    Copy Object copyTo PUT /buckets/{bucketKey}/objects/{objectKey}/copyto/{newObjName}
    Generate Signed S3 Download URL signedS3Download GET /buckets/{bucketKey}/objects/{objectKey}/signeds3download
    Generate Signed S3 Upload URL signedS3Upload GET /buckets/{bucketKey}/objects/{objectKey}/signeds3upload
    Complete Upload to S3 Signed URL completeSignedS3Upload POST /buckets/{bucketKey}/objects/{objectKey}/signeds3upload
    Batch Generate Signed S3 Download URLs batchSignedS3Download POST/buckets/{bucketKey}/objects/batchsigneds3download
    Batch Generate Signed S3 Upload URLs batchSignedS3Upload POST /buckets/{bucketKey}/objects/batchsigneds3upload
    Complete Batch Upload to S3 Signed URLs batchCompleteUpload POST buckets/{bucketKey}/objects/batchcompleteupload

    SDK-Only Operations

    Operation CategoryOperationMethodDescription

    Objects

    Upload an Object uploadObject Uploads a file or stream by transparently handling operations like obtaining signed URLs, chunking large files for optimal transfer, and notifying OSS to assemble the uploaded parts.
    Download an Object downloadObject Downloads a file by transparently handling operations like obtaining signed download URLs.