简体   繁体   English

Wordpress Rest API无法与Postman一起使用

[英]Wordpress Rest API not working with Postman

I'm using the WordPress REST API plugin. 我正在使用WordPress REST API插件。 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. 当我访问Google Chrome中的API链接时,它会返回JSON响应,但如果我尝试将其与Postman一起使用,则无效。 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? 我认为它与cookie有关,但我不确定为什么它需要一个简单的GET请求的cookie? How do I fix this and get it working with Postman? 我如何解决这个问题并让它与Postman合作?

It seems like an anti-DDOS/bot protection on your hosting ( example ). 它似乎是对您的托管( 示例 )的反DDOS / bot保护。 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. 可能在服务器设置中可以关闭保护,或者您可以询问您的托管支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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