Motyar

@motyar

Freelance Web Developer

Static Web Hosting, made easy

Mar 4, 2016

Simple REST API client in Go ( Google Go )

After writting many Golang REST APIs, I realised need of a REST API client to test these APIs. Becuase CURL commands are complex.


Here is the code

Here is an example use case for Go JSON REST API with mongoDb database

List all the Pandas

go run client.go -url=https://rest-golangapi.rhcloud.com/pandas -method=get

Create new Panda

go run client.go -url=https://rest-golangapi.rhcloud.com/pandas/ -method=post -data='{"Name":"Name of Panda"}'

Delete existing Panda

go run client.go -url=https://rest-golangapi.rhcloud.com/pandas/{Id} -method=delete

Update existing Panda

go run client.go -url=https://rest-golangapi.rhcloud.com/pandas/{Id} -method=put -data='{"Name":"New name"}'



Labels: ,




By :