API
Include the URL of your site in the User-Agent header of your HTTP requests
Share
The share API return a hash value of a code.
This hash added to the playground base url https://play.golang.org/p/ can be shared.
- Endpoint: https://play.golang.org/share:
- HTTP Post Request
- Content-Type: application/x-www-form-urlencoded; charset=UTF-8
- Request Body: the code
- Response: Get a Hash. Example with the home page code v3rrZLwEUC https://play.golang.org/p/v3rrZLwEUC
Run
To get the output of the a run
- Endpoint URL: https://play.golang.org/compile
- POST
- Content-type: application/x-www-form-urlencoded
- Params:
version: "2"
body: "The Go Code". Example of Request Body
that leads to the following request Body:
version=2&body=package+main%0A%0Aimport+(%0A%09%22fmt%22%0A)%0A%0Afunc+main()+%7B%0A%09fmt.Println(%22Hello%2C+playground%22)%0A%7D%0A
- Response: Json
{
"Errors":"",
"Events":[
{
"Message":"Hello, playground\n",
"Kind":"stdout",
"Delay":0
}
]
}
Documentation / Reference
- Go Playground at http://play.golang.org, and may be embedded within other pages,
- Compile Code in Go: https://groups.google.com/forum/#!searchin/golang-dev/playground|sort:relevance/golang-dev/mibXDrZ-t5g/FHdnGsuAfFYJ