Get presigned URLs for uploading a file to a Synthetic test using multipart upload.
Returns the presigned URLs for each part along with the bucket key that references the file.
This endpoint requires
any
of the following permissions:
synthetics_write
synthetics_create_edit_trigger
OAuth apps require the synthetics_write authorization scope to access this endpoint.
"""
Get presigned URLs for uploading a test file returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.synthetics_apiimportSyntheticsApifromdatadog_api_client.v2.model.synthetics_test_file_multipart_presigned_urls_partimport(SyntheticsTestFileMultipartPresignedUrlsPart,)fromdatadog_api_client.v2.model.synthetics_test_file_multipart_presigned_urls_requestimport(SyntheticsTestFileMultipartPresignedUrlsRequest,)fromdatadog_api_client.v2.model.synthetics_test_file_multipart_presigned_urls_request_bucket_key_prefiximport(SyntheticsTestFileMultipartPresignedUrlsRequestBucketKeyPrefix,)body=SyntheticsTestFileMultipartPresignedUrlsRequest(bucket_key_prefix=SyntheticsTestFileMultipartPresignedUrlsRequestBucketKeyPrefix.API_UPLOAD_FILE,parts=[SyntheticsTestFileMultipartPresignedUrlsPart(md5="1B2M2Y8AsgTpgAmY7PhCfg==",part_number=1,),],)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=SyntheticsApi(api_client)response=api_instance.get_test_file_multipart_presigned_urls(public_id="abc-def-123",body=body)print(response)
# Get presigned URLs for uploading a test file returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::SyntheticsAPI.newbody=DatadogAPIClient::V2::SyntheticsTestFileMultipartPresignedUrlsRequest.new({bucket_key_prefix:DatadogAPIClient::V2::SyntheticsTestFileMultipartPresignedUrlsRequestBucketKeyPrefix::API_UPLOAD_FILE,parts:[DatadogAPIClient::V2::SyntheticsTestFileMultipartPresignedUrlsPart.new({md5:"1B2M2Y8AsgTpgAmY7PhCfg==",part_number:1,}),],})papi_instance.get_test_file_multipart_presigned_urls("abc-def-123",body)
// Get presigned URLs for uploading a test file returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){body:=datadogV2.SyntheticsTestFileMultipartPresignedUrlsRequest{BucketKeyPrefix:datadogV2.SYNTHETICSTESTFILEMULTIPARTPRESIGNEDURLSREQUESTBUCKETKEYPREFIX_API_UPLOAD_FILE,Parts:[]datadogV2.SyntheticsTestFileMultipartPresignedUrlsPart{{Md5:"1B2M2Y8AsgTpgAmY7PhCfg==",PartNumber:1,},},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewSyntheticsApi(apiClient)resp,r,err:=api.GetTestFileMultipartPresignedUrls(ctx,"abc-def-123",body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `SyntheticsApi.GetTestFileMultipartPresignedUrls`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `SyntheticsApi.GetTestFileMultipartPresignedUrls`:\n%s\n",responseContent)}
// Get presigned URLs for uploading a test file returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.SyntheticsApi;importcom.datadog.api.client.v2.model.SyntheticsTestFileMultipartPresignedUrlsPart;importcom.datadog.api.client.v2.model.SyntheticsTestFileMultipartPresignedUrlsRequest;importcom.datadog.api.client.v2.model.SyntheticsTestFileMultipartPresignedUrlsRequestBucketKeyPrefix;importcom.datadog.api.client.v2.model.SyntheticsTestFileMultipartPresignedUrlsResponse;importjava.util.Collections;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();SyntheticsApiapiInstance=newSyntheticsApi(defaultClient);SyntheticsTestFileMultipartPresignedUrlsRequestbody=newSyntheticsTestFileMultipartPresignedUrlsRequest().bucketKeyPrefix(SyntheticsTestFileMultipartPresignedUrlsRequestBucketKeyPrefix.API_UPLOAD_FILE).parts(Collections.singletonList(newSyntheticsTestFileMultipartPresignedUrlsPart().md5("1B2M2Y8AsgTpgAmY7PhCfg==").partNumber(1L)));try{SyntheticsTestFileMultipartPresignedUrlsResponseresult=apiInstance.getTestFileMultipartPresignedUrls("abc-def-123",body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling SyntheticsApi#getTestFileMultipartPresignedUrls");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get presigned URLs for uploading a test file returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_synthetics::SyntheticsAPI;usedatadog_api_client::datadogV2::model::SyntheticsTestFileMultipartPresignedUrlsPart;usedatadog_api_client::datadogV2::model::SyntheticsTestFileMultipartPresignedUrlsRequest;usedatadog_api_client::datadogV2::model::SyntheticsTestFileMultipartPresignedUrlsRequestBucketKeyPrefix;#[tokio::main]asyncfnmain(){letbody=SyntheticsTestFileMultipartPresignedUrlsRequest::new(SyntheticsTestFileMultipartPresignedUrlsRequestBucketKeyPrefix::API_UPLOAD_FILE,vec![SyntheticsTestFileMultipartPresignedUrlsPart::new("1B2M2Y8AsgTpgAmY7PhCfg==".to_string(),1,)],);letconfiguration=datadog::Configuration::new();letapi=SyntheticsAPI::with_config(configuration);letresp=api.get_test_file_multipart_presigned_urls("abc-def-123".to_string(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get presigned URLs for uploading a test file returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.SyntheticsApi(configuration);constparams: v2.SyntheticsApiGetTestFileMultipartPresignedUrlsRequest={body:{bucketKeyPrefix:"api-upload-file",parts:[{md5:"1B2M2Y8AsgTpgAmY7PhCfg==",partNumber: 1,},],},publicId:"abc-def-123",};apiInstance.getTestFileMultipartPresignedUrls(params).then((data: v2.SyntheticsTestFileMultipartPresignedUrlsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));