Bu sayfa henüz yerel dilinizde mevcut değildir. Daha fazla dil seçeneği eklemek için yoğun bir şekilde çalışıyoruz. Desteğiniz için teşekkür ederiz.
ImageSearch
ImageSearch
- What's New
- Service Overview
- Getting Started
- API Reference
- SDK Reference
- FAQs
- General Reference
On this page
Show all
Copied.
Querying an Image
This section describes how to query an image using AK/SK authentication.
Replace the AK/SK in the sample code with the actual AK/SK. Set the Path parameter in the initialized DeletePictureRequestReq command to specify the URL of the image you want to query. After the configuration is complete, run the code.
- The sample code for querying an image is as follows:
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" imagesearch "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/imagesearch/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/imagesearch/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/imagesearch/v1/region" ) func main() { // Set the obtained AK and SK. ak := "<YOUR AK>" sk := "<YOUR SK>" auth := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() // Set the request client. In this example, CN North-Beijing4 is used. client := imagesearch.NewImageSearchClient( imagesearch.ImagesearchClientBuilder(). WithRegion(region.ValueOf("cn-north-4")). WithCredential(auth). Build()) // Set the instance name. request := &model.RunCheckPictureRequest{ InstanceName: "instance-name", } //Set the image URL. path := "https://bucketname.obs.cn-north-4.myhuaweicloud.com/imagesearch/test.jpg" request.Body = &model.DeletePictureReq{ Path: &path, } response, err := client.RunCheckPicture(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
- Execute the sample code. If the image query result is displayed on the console, the code is successfully executed. For details, see Querying an Image.
RunCheckPictureResponse {"exist":"true"}
Parent topic: Using the Go SDK
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot