|
Alain Brown |
at Feb 25, 2013 at 12:20 am
|
⇧ |
| |
Have you tried the "net/http" package?
http://golang.org/pkg/net/http/The standard package has enough for me. And you can use the "encoding/json"
package for JSON unmarshalling.
http://golang.org/pkg/encoding/json/#example_UnmarshalPretty straight forward to execute a get or post on a URL,
resp, err := http.Get("http://example.com/")
...
resp, err := http.Post("http://example.com/upload", "image/jpeg", &buf)
return a byte[] and unmarshall it into whatever type you like:
type Animal struct {
Name string
Order string
}
var animals []Animal
err := json.Unmarshal(resp, &animals)
I suppose in your case a map. I don't think its going to get much simpler
than that :-). Happy coding
On Friday, November 30, 2012 7:41:59 PM UTC-5, José Carlos Nieto wrote:I'm looking for a Go package that could just talk to HTTP APIs, receive a
JSON response and then convert that response into a map[string]interface{}
so I could use it easily.
I would like a simple solution like
http://rubydoc.info/gems/rest-client/1.6.7/frames. I found gorest but
gorest is a server framework and that's not really what I'm looking for.
Does anyone knows a powerful high level HTTP API client?
I would gladly code my own http.Client wrapper but I think that if there's
an existing package that satisfies my need I'd rather contribute.
Thanks,
José Carlos
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/groups/opt_out.