I am currently trying to use the Wikitude Studio Manager API to delete a given target from our target collection. The problem I am having is I keep getting an error: "The specified ID does not refer to a target. The target could not be found."
After reading some forum posts and the api reference, I am starting to get the impression that the target id is not the same as the target name, but since we only seem to have access to the target name, how are we supposed to delete a target using the API.
To add some more specific info for this, the target collection ID is 58ab55fc59c5f6ab3807e0e9 and one of the target ID's that I have been testing is 918b0d10-d601-11e7-9810-0df3cb3ccece.
It should be noted that I have had this issue with any target ID I put in as a value.
Thanks in advance.
you can find all the endpoints our API offers in our documentation.
After creating a target by calling the asynchronous endpoint POST /targetCollection/:tcId/targets you receive an entry in the location property of the response header which looks like this: /cloudrecognition/targetCollection/:tcid/generation/targets/:id
Call this endpoint to receive the status of the target creation. Once the target creation is completed, you receive the information in the payload.
Hope that helps,
Furthermore, you can retrieve the targets of your target collection by calling the endpoint GET /targetCollection/:tcId/target
I think you are misunderstanding my question. I am trying to DELETE a given target from my target collection using the API. The problem I am having is that when I do this I get the error "The specified ID does not refer to a target. The target could not be found." even though the target does exist. My target collection ID is 58ab55fc59c5f6ab3807e0e9 and a sample target name/id I have been using is 918b0d10-d601-11e7-9810-0df3cb3ccece.
I am wondering if the target name is the same as the target ID since the endpoint uses the target ID. If it is not, I am wondering how we get the target ID.
Sorry for the misunderstanding. The target id and the name is not the same. Where do you see that the target still exists?
When I look in the online target manager I can see that the target still exists, as well as that I get the error "The specified ID does not refer to a target. The target could not be found." on my server-side console. This would make sense then since I have been passing the target name.
My question is then how do I get the target ID? Since we need the target ID to use the delete a target endpoint...
Or further to that, if getting the target ID is non-trivial, how can I manually set the target ID to be the same as the target name so I can use the delete endpoint?
You can use the delete endpoint only by setting the target id.
The thing is that I can't find any entry for your target collection id: 58ab55fc59c5f6ab3807e0e9
Which host-url do you use?
I am using the North American server api-us.wikitude.com.
How do I go about finding and/or setting the target ID then?
As I already wrote in a previous response, you can retrieve the targets of your target collection by calling the endpoint GET /targetCollection/58ab55fc59c5f6ab3807e0e9/target as described in the documentation. By the way, I can verify that the target collection exists.
You could as well use the frontend to figure out the name/id: targetmanager-us.wikitude.com
This is the part I am confused about, as you have stated the target name and the target ID are not the same, and I can only use the target ID for the delete endpoint, as evidenced by the error message I am receiving when I try to delete 918b0d10-d601-11e7-9810-0df3cb3ccece, for example. I am wondering how it is then that I find the target ID on the frontend because the target ID is not listed, only the target name.
You could retrieve all targets of your target collection, filter the response array on the name to retrieve the target-item which contains the id. Then you use the id to delete your target.
In order to make it easier in the future to find the target id, we are going to add the target id to the details dialog soon.