Get snippets of current user
Code Block |
---|
GET http://{host}:{port}/{context}/rest/snippets/1.0/snippets |
Code Block |
---|
curl -u username:password -H "Content-Type:application/json" http://bitbucket.example.com/rest/snippets/1.0/snippets |
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Get starred snippets of current user
Code Block |
---|
GET http://{host}:{port}/{context}/rest/snippets/1.0/snippets/starred |
Code Block |
---|
curl -u username:password -H "Content-Type:application/json" http://bitbucket.example.com/rest/snippets/1.0/snippets/starred |
Expand | ||
---|---|---|
| ||
|
Browse snippets
Code Block |
---|
GET http://{host}:{port}/{context}/rest/snippets/1.0/snippets/browse |
Code Block |
---|
curl -u username:password -H "Content-Type:application/json" http://bitbucket.example.com/rest/snippets/1.0/snippets/browse |
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Browse snippets of user
Code Block |
---|
GET http://{host}:{port}/{context}/rest/snippets/1.0/snippets/browse?username={username} |
Code Block |
---|
curl -u username:password -H "Content-Type:application/json" http://bitbucket.example.com/rest/snippets/1.0/snippets/browse?username=johndoe |
Expand | ||
---|---|---|
| ||
|
Get snippets of category
Code Block |
---|
GET http://{host}:{port}/{context}/rest/snippets/1.0/snippets/categories/{guid} |
Code Block |
---|
curl -u username:password -H "Content-Type:application/json" http://bitbucket.example.com/rest/snippets/1.0/snippets/categories/2f7c939e273f4d29b60f08f9a508298a |
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Get snippet by GUID
Code Block |
---|
GET http://{host}:{port}/{context}/rest/snippets/1.0/snippets/{guid} |
Code Block |
---|
curl -u username:password -H "Content-Type:application/json" http://bitbucket.example.com/rest/snippets/1.0/snippets/87dec410f4404d4ca43dc4772a8bd0f0 |
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Get comment by GUID
Code Block |
---|
GET http://{host}:{port}/{context}/rest/snippets/1.0/snippets/{snippetGuid}/comments/{commentGuid} |
Code Block |
---|
curl -u username:password -H "Content-Type:application/json" http://bitbucket.example.com/rest/snippets/1.0/snippets/87dec410f4404d4ca43dc4772a8bd0f0/comments/6b90147977bb42f782610f0211a94cfc |
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Create snippet
Code Block |
---|
POST http://{host}:{port}/{context}/rest/snippets/1.0/snippets |
Code Block |
---|
curl -X POST -u username:password -H "Content-Type:application/json" -d '{ "name" : "Example Snippet", "files" : [{ "name" : "example.sql", "content" : "SELECT * FROM examples" }] }' http://bitbucket.example.com/rest/snippets/1.0/snippets |
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Create comment
Code Block |
---|
POST http://{host}:{port}/{context}/rest/snippets/1.0/snippets/{guid}/comments |
Code Block |
---|
curl -X POST -u username:password -H "Content-Type:application/json" -d '{ "text" : "This is a comment..." }' http://bitbucket.example.com/rest/snippets/1.0/snippets/87dec410f4404d4ca43dc4772a8bd0f0/comments |
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Update snippet
Code Block |
---|
PUT http://{host}:{port}/{context}/rest/snippets/1.0/snippets/{guid} |
Code Block |
---|
curl -X PUT -u username:password -H "Content-Type:application/json" -d '{ "name" : "Example Snippet", "description" : "Example description...", "categories" : [ "Example Category" ], "files" : [{ "name" : "example.sql", "content" : "SELECT * FROM examples" }] }' http://bitbucket.example.com/rest/snippets/1.0/snippets/87dec410f4404d4ca43dc4772a8bd0f0 |
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Update comment
Code Block |
---|
PUT http://{host}:{port}/{context}/rest/snippets/1.0/snippets/{snippetGuid}/comments/{commentGuid} |
Code Block |
---|
curl -X PUT -u username:password -H "Content-Type:application/json" -d '{ "text" : "This is another comment..." }' http://bitbucket.example.com/rest/snippets/1.0/snippets/87dec410f4404d4ca43dc4772a8bd0f0/comments/6b90147977bb42f782610f0211a94cfc |
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Delete snippet
Code Block |
---|
DELETE http://{host}:{port}/{context}/rest/snippets/1.0/snippets/{guid} |
Code Block |
---|
curl -X DELETE -u username:password -H "Content-Type:application/json" http://bitbucket.example.com/rest/snippets/1.0/snippets/87dec410f4404d4ca43dc4772a8bd0f0 |
Delete comment
Code Block |
---|
DELETE http://{host}:{port}/{context}/rest/snippets/1.0/snippets/{snippetGuid}/comments/{commentGuid} |
Code Block |
---|
curl -X DELETE -u username:password -H "Content-Type:application/json" http://bitbucket.example.com/rest/snippets/1.0/snippets/87dec410f4404d4ca43dc4772a8bd0f0/comments/6b90147977bb42f782610f0211a94cfc |