Skip to content

Added example script for create_image_uploads and upsert_images GraphQL mutations#7

Open
denisahearn wants to merge 4 commits intomainfrom
upsert-images-example
Open

Added example script for create_image_uploads and upsert_images GraphQL mutations#7
denisahearn wants to merge 4 commits intomainfrom
upsert-images-example

Conversation

@denisahearn
Copy link
Contributor

@denisahearn denisahearn commented Feb 4, 2026

Why?

I want to demonstrate how to use the create_image_uploads and upsert_images GraphQL mutations

What?

  • Adds api/upsert_images.rb, which shows how to use the create_image_uploads and upsert_images GraphQL mutations
  • Created utils/upload.rb and moved file uploading functions to this file. Centralizes this logic for the example scripts to use.

Screenshot(s)

JIRA Link

No story

Code Review Strategy

QA Strategy

  • Merge latest main

  • Run this command on your local machine and verify on dev that images were uploaded to S3 and attached to the survey you specified:

FIELDAGENT_ACCESS_TOKEN=<Your FieldAgent API token> \
FIELDAGENT_SERVER=https://apidev.sentera.com \
IMAGES_PATH="../test_files" \
SURVEY_SENTERA_ID=<Your survey Sentera ID> \
FILE_EXT="*.jpeg" \
SENSOR_TYPE="RGB" \
ruby upsert_images.rb

json.dig('data', 'create_file_uploads')
end

#
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll see that I moved these upload_file and upload_files methods out of the sample scripts into utils/upload.rb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants