1
$\begingroup$

I'm trying to create a github repository form a notebook, using this simple code

token = "bftoken";
url = "https://api.github.com/user/repos";

data = URLFetch[url, 
 "Parameters" -> {"access_token" -> token, "name" -> "test"}, 
 "Method" -> "POST"]

but I get this result

{"message":"Requires \
  authentication","documentation_url":"https://developer.github.com/v3"}

My token has "full access", so I guess that's not the problem. Could you give me some pointers on how to login(and create this repo)

$\endgroup$
  • $\begingroup$ That is not what I get. I get a prompt asking me to login. !Mathematica graphics only when you hit the CANCEL button, do I get the message you show. So, you need to actually sign in. $\endgroup$ – Nasser Jun 25 '14 at 6:36
  • $\begingroup$ So "access_token" and "name" are your login and password parameters? $\endgroup$ – Mike Honeychurch Jun 25 '14 at 6:41
  • $\begingroup$ @Nasser, yes, I get the prompt too, and then I enter my credentials, but still can't create a repo $\endgroup$ – Marco Aviles Jun 25 '14 at 13:10
2
$\begingroup$

This did the trick

URLFetch["https://api.github.com/user/repos", 
 "Headers" -> {"Authorization" -> "token " <> token}, 
  "BodyData" -> "{\"name\":\"test012\"}", "Method" -> "POST"]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.