Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Delphi:具有基本身份验证的REST请求_Rest_Delphi_Request_Basic Authentication - Fatal编程技术网

Delphi:具有基本身份验证的REST请求

Delphi:具有基本身份验证的REST请求,rest,delphi,request,basic-authentication,Rest,Delphi,Request,Basic Authentication,我使用TRESTClient/THTTPBasicAuthenticator/TRESTRequest/TRESTResponse从服务器获取数据 通过response Ok(200),我没有接收JSON数据,而是得到以下内容: <script type="text/javascript"> <!-- function redirectToIndex() { var adresse = window.location.pathname.split('/');

我使用TRESTClient/THTTPBasicAuthenticator/TRESTRequest/TRESTResponse从服务器获取数据

通过response Ok(200),我没有接收JSON数据,而是得到以下内容:

<script type="text/javascript"> 
<!-- function redirectToIndex()
{       
var adresse = window.location.pathname.split('/');      
var httpURL = window.location.hostname + "/" + "app"; // redirect to root
var httpsURL = "https://" + httpURL;
window.location = httpsURL;
}
redirectToIndex();  //--> 
你能告诉我我的要求有什么问题吗?

谢谢你,彼得。 我设法通过API支持使用正确的登录名/密码来澄清基本身份验证。文件不准确。
Access正在按预期工作。

返回的响应看起来像HTML,其中包含指向位于
https://{target server}/app
的其他资源的重定向脚本。REST客户端不遵循此类重定向。您应该向该资源发出请求,或者使用其他适当的URI。请参阅供应商API文档以了解这一点。谢谢Peter。我确实指出了错误的URI,它不包括我的子域。我确实有另一个错误401的问题:未经授权的访问-您的API密钥是错误的。此时,我正在将API密钥添加到标题中,标题为“authorization:basic XXXX-XXXX-XXXX”。这是正确的方法吗?您没有提供任何有关身份验证的代码。如果你这样做了,一定要把任何敏感信息都删掉。您还可以编辑文档中的问题和引用,以便我们清楚端点需要什么样的身份验证。
406 - Not Acceptable