The whole hunk
from line 19, old and new numbered
/
lines
from line 19
1919 file=$(curl --fail-with-body -sS "${auth[@]}" \
2020 "${base_url}/files" \
22 file_id=$(jq -er '.id' <<<"${file}")
23 printf 'File ID: %s\n' "${file_id}"
22 FILE_ID=$(jq -er '.id' <<<"${file}")
2423 ```
2524
2625 ```bash CLI
from line 90
9190
9291<CodeGroup>
9392 ```bash cURL
94 session=$(
95 jq -n \
96 --arg agent_id "${agent_id}" \
97 --arg environment_id "${environment_id}" \
98 --arg file_id "${file_id}" \
99 '{
100 agent: $agent_id,
101 environment_id: $environment_id,
102 resources: [
103 {
104 type: "file",
105 file_id: $file_id,
106 mount_path: "/data.csv"
107 }
108 ]
109 }' | curl --fail-with-body -sS "${auth[@]}" "${base_url}/sessions" --json @-
110 )
111 session_id=$(jq -er '.id' <<<"${session}")
93 jq -n \
94 --arg agent_id "${AGENT_ID}" \
95 --arg environment_id "${ENVIRONMENT_ID}" \
96 --arg file_id "${FILE_ID}" \
97 '{
98 agent: $agent_id,
99 environment_id: $environment_id,
100 resources: [
101 {
102 type: "file",
103 file_id: $file_id,
104 mount_path: "/data.csv"
105 }
106 ]
107 }' | curl --fail-with-body -sS "${auth[@]}" "${base_url}/sessions" --json @-
112108 ```
113109
114110 ```bash CLI
115 SESSION_ID=$(ant beta:sessions create \
111 ant beta:sessions create \
116112 --agent "$AGENT_ID" \
117 --environment-id "$ENVIRONMENT_ID" \
118 --transform id --raw-output <<EOF
113 --environment-id "$ENVIRONMENT_ID" <<EOF
119114 resources:
120115 - type: file
121116 file_id: $FILE_ID
122117 mount_path: /data.csv
123118 EOF
124 )
125119 ```
126120
127121 ```python Python
from line 362
368362
369363<CodeGroup>
370364 ```bash cURL
371 resource=$(
372 jq -n --arg file_id "${file_id}" '{type: "file", file_id: $file_id}' \
373 | curl --fail-with-body -sS "${auth[@]}" \
374 "${base_url}/sessions/${session_id}/resources" --json @-
375 )
376 resource_id=$(jq -er '.id' <<<"${resource}")
377 printf '%s\n' "${resource_id}" # "sesrsc_01ABC..."
365 jq -n --arg file_id "${FILE_ID}" '{type: "file", file_id: $file_id}' \
366 | curl --fail-with-body -sS "${auth[@]}" \
367 "${base_url}/sessions/${SESSION_ID}/resources" --json @-
378368 ```
379369
380370 ```bash CLI
381 RESOURCE_ID=$(ant beta:sessions:resources add \
371 ant beta:sessions:resources add \
382372 --session-id "$SESSION_ID" \
383373 --type file \
384 --file-id "$FILE_ID" \
385 --transform id --raw-output)
374 --file-id "$FILE_ID"
386375 ```
387376
388377 ```python Python
from line 455
466455<CodeGroup>
467456 ```bash cURL
468457 curl --fail-with-body -sS "${auth[@]}" \
469 "${base_url}/sessions/${session_id}/resources" \
470 | jq -r '.data[] | "\(.id) \(.type)"'
458 "${base_url}/sessions/${SESSION_ID}/resources"
471459
472460 curl --fail-with-body -sS "${auth[@]}" -X DELETE \
473 "${base_url}/sessions/${session_id}/resources/${resource_id}" >/dev/null
461 "${base_url}/sessions/${SESSION_ID}/resources/${RESOURCE_ID}" >/dev/null
474462 ```
475463
476464 ```bash CLI