Skip to content

Instantly share code, notes, and snippets.

@t2psyto
Created October 4, 2012 15:47
Show Gist options
  • Select an option

  • Save t2psyto/3834509 to your computer and use it in GitHub Desktop.

Select an option

Save t2psyto/3834509 to your computer and use it in GitHub Desktop.
curl POST to gitlab snippets api
$ cat > content.py
# -*- coding: utf-8 -*-
# 日本語
# あめんぼあかいなあいうえお
def hello():
print "hello world!"
if __name__ == "__main__":
hello()
^D
$ curl.exe -F "title=test1" -F "file_name=content1.py" -F "code=<content.py" http://demo.gitlabhq.com/api/v2/projects/rubinius/snippets?private_token=qp6szjqmk8bTyMBrnJo5
@t2psyto
Copy link
Author

t2psyto commented Oct 4, 2012

これもOKだった。
curl.exe -d '{"private_token":"qp6szjqmk8bTyMBrnJo5","title":"test1","file_name":"content1.py","code":"hogehoge\nhoge"}' http://demo.gitlabhq.com/api/v2/projects/rubinius/snippets

これはだめだった。違いがわからない。
echo '{"private_token":"qp6szjqmk8bTyMBrnJo5","title":"test1","file_name":"content1.py","code":"hogehoge\nhoge"}' > content.json
curl.exe -d '@content.json' http://demo.gitlabhq.com/api/v2/projects/rubinius/snippets

@t2psyto
Copy link
Author

t2psyto commented Oct 4, 2012

gg

@t2psyto
Copy link
Author

t2psyto commented Oct 4, 2012

curl.exe -d '{"private_token":"qp6szjqmk8bTyMBrnJo5","title":"test1","file_name":"content1.py","code":"hogehoge\nhoge"}' http://demo.gitlabhq.com/api/v2/projects/rubinius/snippets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment