Cercare target recognition | POST /v2/search
Cerca image target, interfaccia di recognition per cercare un'immagine tramite immagine.
Action
POST /v2/search
Autenticazione
Http Header
Content-Type : multipart/form-data
Authorization (solo quando si usa autenticazione API Key Token)
Parametri della richiesta
| Field | Type | Required | Description |
|---|---|---|---|
| image | Multipart | Yes | Stringa base64 encoding del contenuto immagine, supporta immagini in formato JPG e PNG. |
| notracking | String | No | "false" indica che viene restituito trackingImage. "true" indica che viene restituita solo la proprietà targetId rilevata e non viene restituita tracking image. Per WebAR è consigliato includerlo per impostazione predefinita per ridurre la latenza della richiesta. |
Esempio di richiesta con autenticazione Token
curl -X POST -H "Authorization:xxx" --form "image=@trackingImage.jpg;type=image/jpg" --form appId=YOUR-APPID
https://<your-domain>-cn1.crs.easyar.com:8443/v2/search
Esempio di richiesta con autenticazione signature
curl -X POST --form "image=@trackingImage;type=image/jpg"
--form apiKey=YOUR-APIKEY --form appId=YOUR-APPID
--form timestamp=1514736000000
--form signature=xxx
https://<your-domain>-cn1.crs.easyar.com:8443/v2/search
Importante
- Usare sempre Client-end-URL come ingresso recognition. https usa la porta 8443.
- Impostare l'http header Connection: Keep-Alive per ottimizzare il costo delle connessioni ripetute.
Campi restituiti
| Field | Description |
|---|---|
| statusCode | Status code 0 indica autenticazione corretta. Per maggiori dettagli vedere status code |
| result | Messaggio di errore o informazioni di target image |
| timestamp | Ora del server quando viene restituita la response. Usa il formato Unix timestamp in millisecondi |
| result.targetId | ID univoco del target image |
| result.trackingImage | Stringa base64 encoding di tracking image |
| result.name | Nome target |
| result.size | Larghezza dell'immagine recognition (unità cm). L'altezza dell'immagine recognition sarà calcolata automaticamente dal sistema in base all'immagine caricata. La dimensione dell'immagine recognition corrisponde alla dimensione del contenuto virtuale sovrapposto |
| result.meta | Informazioni aggiuntive codificate in base64, ad esempio la stringa generata dopo la codifica base64 di una stringa json |
| result.type | Fisso a ImageTarget |
| result.active | "1" abilitato, "0" disabilitato |
Principali codici restituiti
| Response | HTTPCODE | Status | Result |
|---|---|---|---|
| OK | 200 | 0 | result: { imageBody } |
| NO_RESULT | 404 | 17 | result: { message: "No result: there is no matching." } |
| NO_TARGET | 500 | 18 | result: { message: "Target not found: there is a matching but no target, please report this issue: IMAGE-UUID" } |
| TIMEOUT | 408 | 19 | result: { message: "Request timeout." } |
| OUT_OF_LIMIT | 402 | 21 | result: { message: "You have exceeded the limit of daily scanning." } |
| OUT_OF_QPS | 200 | 21 | result: { message: "Exceed your QPS limitation." } |
| RPC_ERROR | 500 | 20 | result: { message: "Error retrieving results." } |
| OTHER_ERROR | 501 | 30 | result: { message: "Other error occur: details" } |
Codici di errore
Vedere lista completa di status code ed error code
Esempio di richiesta
POST /search/ HTTP/1.1
Host:
Date: Mon, 1 Jan 2018 00:00:00 GMT
Content-Type: application/json
{
"image":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgM...",
"timestamp": 1514736000000,
"appKey": "test_app_key",
"signature": "89985e2420899196db5bdf16b3c2ed0922c0c221"
}
Esempio di risposta
- Se recognition trova una corrispondenza, la struttura restituita è:
HTTP/1.1 200 OK
Content-Type: application/json
{
"statusCode": 0,
"result": {
"target": {
"targetId":"e61db301-e80f-4025-b822-9a00eb48d8d2",
"trackingImage":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgM...",
"name": "easyar",
"size": "5",
"meta": "496fbbabc2b38ecs3460a...",
"type": "ImageTarget",
"modified":1514735000000
"active":"1",
"trackableRate": 0,
"detectableRate": 0,
"detectableDistinctiveness":0,
"detectableFeatureCount": 0,
"trackableDistinctiveness": 0,
"trackableFeatureCount": 0,
"trackableFeatureDistribution": 0,
"trackablePatchContrast": 0,
"trackablePatchAmbiguity": 0
}
},
"timestamp": 1514736000000
}
- Se non esiste un target image corrispondente, l'esempio restituito è:
HTTP/1.1 404 NOT FOUND
Content-Type: application/json
{
"statusCode": 17,
"result": {
"message": "No result: there is no matching."
}
}