Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: add repeat instances to redcap_upload_file_oneshot #510

Open
jrob95 opened this issue Sep 13, 2023 · 2 comments
Open

Feature request: add repeat instances to redcap_upload_file_oneshot #510

jrob95 opened this issue Sep 13, 2023 · 2 comments
Assignees

Comments

@jrob95
Copy link
Contributor

jrob95 commented Sep 13, 2023

Hi there, just some queries about redcap_upload_file_oneshot

What happens when you upload a file to a repeating instance? I noticed that redcap_download_file_oneshot has an option to specify repeating instance. Would that be possible here?

Kind regards,
Jack

@wibeasley wibeasley self-assigned this Sep 15, 2023
@renatocava
Copy link

Hello, I have the same request, it is important to be able to upload files in different instances.

I have tried adding the repeat_instrument and repeat_instance arguments as in the case of redcap_download_file_oneshot but it does not recognize them.

Error in REDCapR::redcap_file_upload_oneshot(file_name = "1729606165286.jpg", : unused arguments (repeat_instrument = "datos_sensibles", repeat_instance = 5)

@renatocava
Copy link

renatocava commented Oct 30, 2024

I worked directly with the REDCap API and added the same repeat_instrument and repeat_instance arguments to the bodyform and uploaded the file to the specific instance.

token <- Sys.getenv("token_protocol")
url <- "#######################"
file <- '1729606165286.jpg'
formData <- list("token"=token,
                 action='import',
                 content='file',
                 record='10',
                 field='field',
                 event='baseline_visit_arm_1',
                 repeat_instrument='datos_sensibles',
                 repeat_instance='5',
                 
                 returnFormat='csv',
                 file=httr::upload_file(file)
)
response <- httr::POST(url, body = formData, encode = "multipart")
result <- httr::content(response)
print(result)

this way it worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants