Greetings fellow R users. I'm struggling with the syntax of submitting a PUT request
I'm trying to insert a few PUT requests into some legacy R code that I have that performs daily ETL on a small database. These requests will add users to an email mailing list in MailChimp. I have been able to get my GET requests formatted into syntax that R (specifically the httr package) accepts: GET(" https://us10.api.mailchimp.com/3.0/lists/list_id_XXXXX/members/MEMBER_HASH_#######", query = list(apikey = 'XXXXXXXXXXXXXX')) However when I try to do something similar for PUT requests this simple syntax isn't working - you can't just pass the API KEY and/or requested parameters directly through the URL. I get a 401 error if I use the same syntax I used for GET. I believe that I need to use the CONFIG option to pass the API key (either using AUTHENTICATE or ADD_HEADERS) and the requested parameters in the BODY to get the PUT request to work but I can't get the syntax to work - this gives a 400 error: auth <- authenticate("anystring", "XXXXXXXXXXXXXX", type = "basic") parms <- '[{"email_address" : "some_u...@domain.com", "status_if_new" : "subscribed"}]' PUT(" https://us10.api.mailchimp.com/3.0/lists/list_id_XXXXX/members/MEMBER_HASH_####### ",config=auth,body=parms,encode="json") If anyone can point me to a more flushed out example that would be amazing...but even just some tips on how to get more info on my error message to help me troubleshoot my syntax would also be a big help. I've also been trying to get httpput (from the RCurl package) but also struggling with the syntax there. Thanks! Jared [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.