Getting 200, but returned data is HTML

[ad_1]

Hello, I have followed the instructions step by step, and when testing REST API, I am getting 200 as return code, but returned data is pure HTML (looks like a web page). Wondering if some settings are wrong, if NGNIX is interfering (although I do have some settings in .htaccess) or if the call is badly coded.
Any hint?

Javascript code:

function wordpressConnector(){

  // URL and params
  var root = 'https://mydomain.com/wp-json';
  var endpoint = '/jwt-auth/v1/token';
  var queryParams = '?username=SOMEUSER&password=APASSWORD';
   
  // parameters for url fetch
  var params = {
    'method': 'POST',
    'muteHttpExceptions': true
  };
   
  // call the API
  var response = UrlFetchApp.fetch(root + endpoint + queryParams, params);
  var data = response.getContentText(); // returns pure HTML webpage
  var code = response.getResponseCode(); // returns 200
  var headers = response.getHeaders();
}

returned headers:

{
    "x-sucuri-cache": "MISS",
    "x-proxy-cache-info": "0 NC:000000 UP:SKIP_CACHE_SET_COOKIE",
    "x-cache-enabled": "True",
    "Transfer-Encoding": "chunked",
    "Set-Cookie": "wordpress_google_apps_login=xxxxxxxxxxxxxxxxxxxxxxxx; path=/; secure; HttpOnly",
    "Content-Security-Policy": "upgrade-insecure-requests;",
    "X-XSS-Protection": "1; mode=block",
    "X-Content-Type-Options": "nosniff",
    "x-proxy-cache": "MISS",
    "x-tec-api-version": "disabled",
    "X-Frame-Options": "SAMEORIGIN",
    "Content-Encoding": "br",
    "x-httpd-modphp": "1",
    "Connection": "keep-alive",
    "Vary": "Accept-Encoding",
    "Link": "<https://mydomain.com/?p=29989>; rel=shortlink",
    "host-header": "yyyyyyyyyyyyyyyyyyyyyyyyy",
    "Content-Type": "text/html; charset=UTF-8",
    "x-sucuri-id": "14012",
    "Date": "Wed, 12 Oct 2022 09:48:42 GMT",
    "Server": "Sucuri/Cloudproxy"
}

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer