GetCollectionByID Access API Method
参数
Id
字符串
必填
正在加载...
退货
collection
对象
正在加载...
id
字符串
正在加载...
transaction_ids
数组
正在加载...
请求
1包 main23导入 (4"上下文"5"编码/十六进制"6"encoding/json"7"fmt"8"日志"910"github.com/onflow/flow/protobuf/go/flow/access"11)1213func main() {1415// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.16client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")17ctx := context.Background()18如果 err != nil {19log.Fatalf("err: %v", err)20}2122// Get Collection by ID23collectionId, err := hex.DecodeString("eb6733050812a58450310980032ea2fdbee8a7c5f6aad252abf1ef9d82fd8ff5")24collectionResp, err := client.GetCollectionByID(ctx, &access.GetCollectionByIDRequest{Id: collectionId})25respJSON, err := json.Marshal(collectionResp)26如果 err != nil {27log.Fatal("get collection by ID failed: ", err)28}29fmt.Println("Get Collection by ID:", string(respJSON))30}
1包 main23导入 (4"上下文"5"编码/十六进制"6"encoding/json"7"fmt"8"日志"910"github.com/onflow/flow/protobuf/go/flow/access"11)1213func main() {1415// Requires authenticating before making the request. Refer to Intro Page on how Authentication can be done.16client, err := getAccessClientWithBasicAuth("ENDPOINT-NAME", "TOKEN_GOES_HERE")17ctx := context.Background()18如果 err != nil {19log.Fatalf("err: %v", err)20}2122// Get Collection by ID23collectionId, err := hex.DecodeString("eb6733050812a58450310980032ea2fdbee8a7c5f6aad252abf1ef9d82fd8ff5")24collectionResp, err := client.GetCollectionByID(ctx, &access.GetCollectionByIDRequest{Id: collectionId})25respJSON, err := json.Marshal(collectionResp)26如果 err != nil {27log.Fatal("get collection by ID failed: ", err)28}29fmt.Println("Get Collection by ID:", string(respJSON))30}