@@ -20,6 +20,7 @@ printf \
2020 "language": "en-US"
2121}' >> $request_data
2222
23+ # ds-snippet-start:Navigator3Step2
2324curl --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
3132job_id=$( cat " $response " | grep -o ' "id":"[^"]*' | head -1 | cut -d' "' -f4)
3233upload_urls=$( cat $response | grep -o ' "upload_document":"[^"]*' | cut -d' "' -f4)
34+ # ds-snippet-end:Navigator3Step2
3335
3436echo " Created upload job with ID: $job_id "
3537
@@ -53,6 +55,7 @@ while IFS= read -r url; do
5355 upload_urls_array+=(" $url " )
5456done <<< " $upload_urls"
5557
58+ # ds-snippet-start:Navigator3Step3
5659# Upload each file
5760for 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 "
103107done
108+ # ds-snippet-end:Navigator3Step3
104109
105110echo " "
106111read -p " The documents have been uploaded. Press Enter to update the job status."
107112
113+ # ds-snippet-start:Navigator3Step4
108114curl --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
114121echo " "
115122echo " Bulk upload job has been completed. Response:"
0 commit comments