Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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)

share|improve this question
    
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. –  Nasser Jun 25 at 6:36
    
So "access_token" and "name" are your login and password parameters? –  Mike Honeychurch Jun 25 at 6:41
    
@Nasser, yes, I get the prompt too, and then I enter my credentials, but still can't create a repo –  MHero Jun 25 at 13:10
add comment

1 Answer 1

up vote 1 down vote accepted

This did the trick

URLFetch["https://api.github.com/user/repos", 
 "Headers" -> {"Authorization" -> "token " <> token}, 
  "BodyData" -> "{\"name\":\"test012\"}", "Method" -> "POST"]
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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