简体   繁体   中英

Wordpress Rest API not working with Postman

I'm using the WordPress REST API plugin. When I visit the API link in Google Chrome, it returns a JSON response as it should, but if I try and use it with Postman, it doesn't work. Instead, it returns this response:

<html>
<body>
    <script type="text/javascript" src="/aes.js" ></script>
    <script>function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f
        <d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("8c438240f47c9d866926316329bd2945");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/"; document.cookie="referrer="+escape(document.referrer); location.href="http://adismc.vortekhosting.net/wordpress/wp-json/wp/v2/posts/1?ckattempt=1";
        </script>
        <noscript>This site requires JavaScript to work, please enable JavaScript in your browser or use a browser with JavaScript support</noscript>
    </body>
</html>

I think it has something to do with cookies, but I'm not sure why it would require cookies for a simple GET request? How do I fix this and get it working with Postman?

It seems like an anti-DDOS/bot protection on your hosting ( example ). I've solved the problem with changing my hosting.

Probably the protection can be turned off in server settings or you could ask your hosting support.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM