Sample code for 30+ languages & platforms
Xbase++ Requires Chilkat v11.0.0+

OSS Delete Bucket Objects (Alibaba Cloud)

See more Alibaba Cloud OSS Examples

Demonstrates how to delete objects in a bucket.

The Chilkat S3 functions in the HTTP class are compatible with Alibaba Cloud's OSS service.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oHttp
LOCAL cBucketName
LOCAL cObjectName1
LOCAL cObjectName2
LOCAL oSt
LOCAL oResp

nSuccess := 0

//  This example requires the Chilkat API to have been previously unlocked.
//  See Global Unlock Sample for sample code.

oHttp := CreateObject("Chilkat.Http")

//  Insert your AccessKey ID here:
oHttp:AwsAccessKey := "access-key"

//  Insert your AccessKey Secret here:
oHttp:AwsSecretKey := "secret-key"

//  To delete objects from a bucket located in a different region, use the domain for that region, such as "oss-cn-hangzhou.aliyuncs.com 	"
//  See Alibaba Object Storage Service Regions and Endpoints
oHttp:AwsEndpoint := "oss-us-east-1.aliyuncs.com"

cBucketName := "chilkat"

cObjectName1 := "seahorse.jpg"
cObjectName2 := "orchard.json"

oSt := CreateObject("Chilkat.StringTable")
oSt:Append(cObjectName1)
oSt:Append(cObjectName2)

oResp := CreateObject("Chilkat.HttpResponse")
nSuccess := oHttp:S3_DeleteObjects(cBucketName, oSt, oResp)
IF (nSuccess == 0)
    ? oHttp:LastErrorText
    oHttp:destroy()
    oSt:destroy()
    oResp:destroy()
    RETURN
ENDIF

? "Response status code = " + Str(oHttp:LastStatus)

//  Display the XML response.
? oResp:BodyStr

oHttp:destroy()
oSt:destroy()
oResp:destroy()