Start a new topic

Web Service not available

Web Service not available


Hello,

I try to write a Java-code that contacts the Cloud-Target:

https://api.wikitude.com/targets/wtc-url

 

But I get as a response from the server an 404-Error.

Why is the Service "api.wikitude.com" not available?

This URL works with my API token not, too:

https://api.wikitude.com/wtc-url/?token=myApiToken&version=2

 

I get for response this:

{"code":200,"reason":"VERB_NOT_SUPPORTED","message":"The GET method is not supported. Please, use a POST request for this service.","moreInfo":"http://www.wikitude.com/developer/documentation"}

 

Hi Mario,

thanks for your interest in our service. 

Our server is up and running. Are you following the specification at this link: Wikitude Targets API - Generate WTC ?

Please check that you are using the right HTTP verb (i.e. POST) and settings the headers in your request.

If you need an example of a request performed via Java then you can have a look at our GitHub repository: https://github.com/Wikitude/wikitude-targets-api-samples

For debugging you can use a nice plug-in for Chrome: POSTMAN https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en .

Please let us know if it solves the issue.

Best,

Simone

 

Thank you for your answer.

I installed the Chrome extension. Thats a cool tool :)

 

But the service does not work yet :( I have tried many different mehtods:

https://api.wikitude.com/wtc-url/?token=key&version=2   with POST method --> 404 Error

POST /wtc-url/?token=key&version=2 HTTP/1.1
Host: api.wikitude.com
Cache-Control: no-cache

--> Error 404

https://api.wikitude.com/targets/wtc-url/?token=key&version=2 with POST method --> 400 Error

POST /targets/wtc-url/?token=key&version=2 HTTP/1.1
Host: api.wikitude.com
Cache-Control: no-cache

JSON respond:

{
    "code": 400,
    "reason": "CONTENT_TYPE_MISMATCH",
    "message": "The specified Content-Type doesn't match the one requested by the API. Please use 'application/json' as Content-Type in the HTTP header.",
    "cause": ,
    "moreInfo": "http://www.wikitude.com/developer/documentation"
}

 

POST /targets/wtc-url/?token=key&version=2 HTTP/1.1
Host: api.wikitude.com
Content-Type: application/json
Cache-Control: no-cache

{
    "code": 400,
    "reason": "INVALID_JSON",
    "message": "The request contains an invalid JSON data in the entity-body.",
    "moreInfo": "http://json.org"
}

 

POST /targets/wtc-url/?token=key&version=2 HTTP/1.1
Host: api.wikitude.com
Content-Type: application/json
X-Api-Token: key
X-Version: 2
Cache-Control: no-cache

{
    "code": 400,
    "reason": "INVALID_JSON",
    "message": "The request contains an invalid JSON data in the entity-body.",
    "moreInfo": "http://json.org"
}

 

 

Solution:

 

POST /targets/wtc-url/?token=key&version=2 HTTP/1.1
Host: api.wikitude.com
Content-Type: application/json
X-Api-Token: key
X-Version: 2
Cache-Control: no-cache

{ "targets" : }

Hi Mario,

I'm happy to hear that you solved the issue!

One note: if you are going to use the headers then you can avoid to send as query parameters 'token' and 'version'.

Have fun with our API :)

Best,

Simmo
Login or Signup to post a comment