Search code examples
androidjsonwordpressretrofit

Wrong response from Wordpress Rest API


I have a problem with fetching data from Wordpress by REST Api. In browser I have correct answer, but my Android app fetching wrong data.

Error:

java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $

This is response from API:

Connected to remote service
Processing queued up service tasks: 5
<-- 200 https://www.mypantry.pl/wp-json/wp/v2/posts?categories=32 (681ms)
date: Mon, 15 May 2023 19:24:14 GMT
content-type: text/html
server: imunify360-webshield/1.18
last-modified: Monday, 15-May-2023 19:24:14 GMT
cache-control: private, no-store, no-cache, must-revalidate, proxy-revalidate, max-    age=0, s-maxage=0
cf-edge-cache: no-cache
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow">
<title>One moment, please...</title>
<style>
body {
    background: #F6F7F8;
    color: #303131;
    font-family: sans-serif;
    margin-top: 45vh;
    text-align: center;
}
</style>
</head>
<body>
<h1>Please wait while your request is being verified...</h1>
<form id="wsidchk-form" style="display:none;"    action="/z0f76a1d14fd21a8fb5fd0d03e0fdc3d3cedae52f" method="get">
<input type="hidden" id="wsidchk" name="wsidchk"/>
</form>
<script>
(function(){
    var west=+((+!+[])+(+!+[]+!![]+[])+(+!+[]+!![]+!![]+!![]+!![]+!![]+!![]+!![])+(+!+[]+!![]+!![]+!![]+!![]+!![]+!![]+!![]+[])+(+!+[]+!![]+!![]+!![]+!![]+!![])+(+!+[]+!![]+[])+(+!+[]+!![]+!![]+!![])),
    east=+((+!+[]+!![]+!![]+!![]+!![])+(+!+[]+!![]+!![]+!![]+!![]+!![]+!![]+[])+(+!+[]+!![]+!![]+!![])+(+!+[]+!![]+!![]+!![]+!![]+!![]+!![]+[])+(+![])+(+!+[]+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![]+[])+(+![])),
    x=function(){try{return !!window.addEventListener;}catch(e){return !!0;} },
    y=function(y,z){x() ? document.addEventListener("DOMContentLoaded",y,z) : document.attachEvent("onreadystatechange",y);};
y(function(){
    document.getElementById('wsidchk').value = west + east;
    document.getElementById('wsidchk-form').submit();
}, false);
tagSocket(93) with statsTag=0xffffffff, statsUid=-1
})();
</script>
</body>
</html>
<-- END HTTP (1371-byte body)

I don't have any idea why I can fetch data by browser, but not directly by app.


Solution

  • That Must Be API Key problem please check once again your API keys about you stored ........