Skip to content

Instantly share code, notes, and snippets.

@protinam
Last active November 30, 2017 23:48
Show Gist options
  • Save protinam/07e9c1fdbce34f1c55ac65cc01f9293e to your computer and use it in GitHub Desktop.
Save protinam/07e9c1fdbce34f1c55ac65cc01f9293e to your computer and use it in GitHub Desktop.
Prototype API Usage Example

Register a user

curl -X POST https://api.projectwyvern.com/users/register -H 'Content-Type: application/json' -d '{"username":"test","ethereumAddress":""}'

{"success":true}

List an item

curl -X POST https://api.projectwyvern.com/items/create -H 'Content-Type: application/json' -d '{"username":"test","title":"Example Title","tags":["tagA"],"secretKey":"abc123","instantBuyPrice":10,"description":"Example Description","imageURL":"http://via.placeholder.com/200x200"}'

{"success":true}

Retrieve the list of items

curl -X GET https://api.projectwyvern.com/items

[{"id":1,"sellerName":"test","title":"Example Title","tags":["tagA"],"instantBuyPrice":10,"description":"Example Description","imageURL":"http://via.placeholder.com/200x200","sold":false}]

Buy an item (for the prototype we're omitting the actual purchase transaction)

curl -X POST https://api.projectwyvern.com/items/claim -H 'Content-Type: application/json' -d '{"itemId":1}'

{"success":true,"secretKey":"abc123","saleId":1}

Write a review

curl -X POST https://api.projectwyvern.com/reviews/create -H 'Content-Type: application/json' -d '{"rating":5,"note":"Example Note","saleId":1}'

{"success":true}

Retrieve the list of items again - item will now show as sold

curl -X GET https://api.projectwyvern.com/items

[{"id":1,"sellerName":"test","title":"Example Title","tags":["tagA"],"instantBuyPrice":10,"description":"Example Description","imageURL":"http://via.placeholder.com/200x200","sold":true}]

Retrieve the item details, including the review

curl -X GET https://api.projectwyvern.com/items/1/details

{"success":true,"item":{"sellerName":"test","title":"Example Title","tags":["tagA"],"instantBuyPrice":10,"description":"Example Description","imageURL":"http://via.placeholder.com/200x200","sold":true},"sale":{"salePrice":10},"review":{"note":"Example Note","rating":5}}

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