如何使用GOLang通过调用REST API在BitBucket中创建REPOSITORY

Is there any REST API from BitBucket, which can be called from a GoLang so that it will create a new REPOSITORY. I can fetch the details of existing but not able to create a new one. Remember CURL is not requirement. Kindly help, stuck from some time into it. Is there any way do it via JAVA as well? If Java can do, then I think GoLang should be able to. Suggest!

Thanks for Help guys! Yes, I am able to resolve this issue,with a colleague pointing out the mistake. Things required: 1. You should be having complete access for the bitBucket. 2. You should have correct URL where to connect with for the REST API. Note: REST API url is different than that of direct URL and get the versions Correct.

Go Code for same is::

import (
    "encoding/json"
    "bytes"
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {

    url:=fmt.Sprintf("https://<Server BitBucket>/rest/api/1.0/projects/<PROJECT WHERE REPO TO BE CREATED>/repos");
   jsonData := map[string]string{"name":"<REPONAME>","scmID":"git","forkable":"true"}  
    jsonValue,_:=json.Marshal(jsonData)
    req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonValue))
    req.Header.Set("Content-Type", "application/json")
        req.SetBasicAuth("<USERNAME>", "<PASSWORD>")
    fmt.Println("++",req)

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }

    defer resp.Body.Close()

    fmt.Println("response Status:", resp.Status)
    fmt.Println("response Headers:", resp.Header)
    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Println("response Body:", string(body))
    }

This will give the response as 201 and yes, it will be created!!

Looking through their documentation I found this endpoint which allows you to create repos using their API.

Calling a REST API endpoint can be done from any language.

Here is a nice tutorial where it explains how you can call json API endpoints using GO.