Start a new topic

Trying to upload target image with target api - help

Trying to upload target image with target api - help

Hello Shruti,

The problem is that you are trying to upload an image that is locally stored. This is exactly why it is working when you upload the image from google docs. So what you need to do is upload the image you are taking from your phone to a server, so you need to store it somewhere, and then upload it to the target collection.

Thanks
Eva

 

I am using a educational wikitude license that helps me to recognize images that I have downloaded (etc format). As a next step I would like to upload the image taken for my android device on the target collection created. I am using the CloudManagerAPI's provided by wikitude to create a target collection and upload images. 


I am successfully able to create the target collection using createTargetCollection. I now want to call addTarget API to upload the image which is failing with the error mentioned below:


DOWNLOAD_FAILED (400): (400): The system could not download the file you have specified as Target. Please check the URL and access rights.


It works if i upload a image for my google docs, however it fails to upload the image taken by my android device.


Hello Shruti,

In order to provide you a proper solution, could you please provide me with these details:
  • All the Wikitude products / services you are using
  • The exact steps you are taking.

Thanks

Eva

 

Hi,


I am trying to upload a target image to the collection I created from an android application. I am using examples provided by wikitude. My target application is successfully created. I was to upload a image from my device storage to target collection. Please let me know is there a way I can upload a local image.


For now I am getting the following error: DOWNLOAD_FAILED (400): (400): The system could not download the file you have specified as Target. Please check the URL and access rights.


Regards,

Shruti


Could you send us an email to support@wikitude.com with the title of this thread as subject, a short description in the email and include your Wikitude registered email address. We will check the data immediately.

Regards,
Christian

Thank you for your help Christian,

I've also tried with those examples but all i get is:


CREATE TARGETCOLLECTION
0: Unexpected Error

 

(I've tried commenting the targetCollection creation and giving my target collection id so it jumps to the add target section but same "0: Unexpected Error" appears)

I tried just now, downloading both files from the example and changing only the "$token" variable with mine and i get that error.

 

Am i missing something obvious?

 

Thanks again for your time and willingness.

Hello Mauricio,

thank you for your post. I recommend you to use our cloud recognition api instead. Since it contains all features the Targets API provides we are discussing a deprecation of the Targets API. 

We also have examples to the CloudAPI on github and an API reference.

Regards,
Christian

Hello everyone, i'm new to the community so i hope to make a good post.

 

I'm having a problem trying to post targets with the target api. I've downloaded the examples from github:

https://github.com/Wikitude/wikitude-targets-api-samples/tree/master/PHP

But i keep getting the following error:

"failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request"

 

I did a print of the '$options' variable before creating the 'stream_context_create' and it shows me the following:

Array ( => Array ( => POST => {"targets":} => Content-Type: application/json X-Version: 3 X-Api-Token: MYTOKEN(*) ) )

(*) Replaced the token because don't know if it can be posted here.

 

- Full error in case needed:

Warning: file_get_contents(https://api.wikitude.com/cloudrecognition/targetCollection/57d56c329b2f36590156f2c4/target): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in D:\ProgramasInstalados\xampp\htdocs\TargetAPI\src\TargetsAPI.php on line 90

(Line 90 is $result = file_get_contents( $this->API_ENDPOINT, false, $context );)

 

Thanks in advance and i will be very grateful if someone can point me in the right direction.

 

 

 
Login or Signup to post a comment