Log in or register to post comments

C# - 404 error with PUT /targets/target_id

March 27, 2017 - 5:08pm #1

Hi!

I'm using C#, and have successfully uploaded images to Vuforia's cloud using the POST command.

However, when I try doing a PUT to "https://vws.vuforia.com/targets/{target_id}" (where "{target_id}" is replaced with the proper target id), I get a 404 error.

Essentially, I'm using the same code as the POST method, except switched to PUT and adding the "/{target_id}" to the WWW call, like so:

    string host         = "https://vws.vuforia.com";
    string targetPath   = "/targets";
    string targetIDPath = "/" + targetID;
    ...
    WWW wwwRequest = new WWW(host + targetPath + targetIDPath, System.Text.Encoding.UTF8.GetBytes(jsonBody), headers);

I have also tried changing "/targets" to "/targets/{target_id}" for the signing string, but that didn't make a difference.

Where exactly should the target_id be used?  Is there something else that is used for the PUT that is not used for the POST?

Side note: The image targets for the corresponding target IDs I've tried updating. are ACTIVE.

C# - 404 error with PUT /targets/target_id

February 14, 2019 - 12:43pm #4

I'm having the same issue. I can make a GET request for the target summary report with /targets/{target_id}, but when using the same target id to make a PUT request, it fails with error code 404. 

Could you post how you resolved the issue, please?

EDIT:

I found a solution. WWW seemed to not work, so i used UnityWebRequest instead. 

create your request,

UnityWebRequest webRequest = UnityWebRequest.Put(serviceURI, System.Text.Encoding.UTF8.GetBytes(jsonPostObj));

set headers,

webRequest.SetRequestHeader("host", url);

        webRequest.SetRequestHeader("date", date);

        webRequest.SetRequestHeader("content-type", contentType);

webRequest.SetRequestHeader("authorization", string.Format("VWS {0}:{1}", access_key, signature));

then send the request,

webRequest.SendWebRequest();

 

works like a charm.

C# - 404 error with PUT /targets/target_id

March 28, 2017 - 2:24pm #3

Alrighty, I'll continue via IM, and post the solution here.

Also, am using Unity 5.4.3f1.

C# - 404 error with PUT /targets/target_id

March 28, 2017 - 1:48pm #2

Hello,

That error code is specific to "unknown target": https://library.vuforia.com/articles/Solution/How-To-Interperete-VWS-API-Result-Codes

I'm not sure exactly what you're trying to do, but your action and URL look correct for updating a target: https://library.vuforia.com/articles/Solution/How-To-Update-a-Target-Using-the-VWS-API

I think your authentication header is correct otherwise you'd get a different error code returned.

Have you tried doing the same operation using our sample code: https://developer.vuforia.com/downloads/samples (bottom of the page). If that doesn't work then please IM me and we can dig some more.

Thanks.


Log in or register to post comments