Skip to content

Commit f7b4861

Browse files
Adding codeDepot markers to steps
1 parent e40cb5b commit f7b4861

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

examples/Navigator/eg003BulkUpload.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ printf \
2020
"language": "en-US"
2121
}' >> $request_data
2222

23+
#ds-snippet-start:Navigator3Step2
2324
curl --request POST ${base_path}/accounts/${account_id}/upload/jobs \
2425
--header "Authorization: Bearer ${ACCESS_TOKEN}" \
2526
--header "Accept: application/json" \
@@ -30,6 +31,7 @@ curl --request POST ${base_path}/accounts/${account_id}/upload/jobs \
3031
# Extract job ID and upload URLs for each document
3132
job_id=$(cat "$response" | grep -o '"id":"[^"]*' | head -1 | cut -d'"' -f4)
3233
upload_urls=$(cat $response | grep -o '"upload_document":"[^"]*' | cut -d'"' -f4)
34+
#ds-snippet-end:Navigator3Step2
3335

3436
echo "Created upload job with ID: $job_id"
3537

@@ -53,6 +55,7 @@ while IFS= read -r url; do
5355
upload_urls_array+=("$url")
5456
done <<<"$upload_urls"
5557

58+
#ds-snippet-start:Navigator3Step3
5659
# Upload each file
5760
for i in "${!demo_files[@]}"; do
5861
file_path="${demo_files[$i]}"
@@ -94,22 +97,26 @@ for i in "${!demo_files[@]}"; do
9497

9598
echo "Uploading $filename..."
9699

100+
97101
# Make PUT request with binary file content and required headers.
98102
curl --request PUT "$upload_url" \
99103
--header "x-ms-blob-type: BlockBlob" \
100104
--header "x-ms-meta-filename: ${filename}" \
101105
--header "Content-Type: ${content_type}" \
102106
--data-binary @"$file_path"
103107
done
108+
#ds-snippet-end:Navigator3Step3
104109

105110
echo ""
106111
read -p "The documents have been uploaded. Press Enter to update the job status."
107112

113+
#ds-snippet-start:Navigator3Step4
108114
curl --request POST "${base_path}/accounts/${account_id}/upload/jobs/${job_id}/actions/complete" \
109115
--header "Authorization: Bearer ${ACCESS_TOKEN}" \
110116
--header "Accept: application/json" \
111117
--header "Content-Type: application/json" \
112118
--output "$response"
119+
#ds-snippet-end:Navigator3Step4
113120

114121
echo ""
115122
echo "Bulk upload job has been completed. Response:"

0 commit comments

Comments
 (0)