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

Use custom API calls with "-- form" syntax #69

Open
davidcarayon opened this issue May 30, 2022 · 1 comment
Open

Use custom API calls with "-- form" syntax #69

davidcarayon opened this issue May 30, 2022 · 1 comment
Labels

Comments

@davidcarayon
Copy link

Hello,

Thanks for a really great and useful package !

In the process of building an internal Shiny app that generate issues using GitLab's API though {gitlabr}, I needed to use a custom API call not provided by this package (file upload, detailed here). This API call has a --form argument which seems to not be supported by {gitlabr}.

Would it be possible to make this kind of API calls available though gitlab() ?

Many thanks in advance

@davidcarayon
Copy link
Author

If it could help, here is the equivalent query that we built with {httr2} :

httr2::request('https://<gitlab_server>/api/v4/projects/<project_id>/uploads') %>% 
        httr2::req_headers("Content-Type"="multipart/form-data", "PRIVATE-TOKEN" = Sys.getenv("MY_TOKEN")) %>%  
        httr2::req_body_multipart(file=curl::form_file(<path_to_img>)) %>%
        httr2::req_perform() %>% 
        httr2::resp_body_json()

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

No branches or pull requests

2 participants