简体   繁体   English

我正在尝试从 Companies House API 获取 pdf 文档

[英]I am trying to fetch a pdf document from Companies House API

I am trying to fetch a pdf document from API using ColdFusion and I receive this error:我正在尝试使用 ColdFusion 从 API 获取 pdf 文档,我收到此错误:

<?xml version="1.0" encoding="UTF-8"?> <Error><Code>InvalidArgument</Code> <Message>Only one auth mechanism allowed; only the X-Amz-Algorithm query parameter, Signature query string parameter or the Authorization header should be specified</Message><ArgumentName>Authorization</ArgumentName> <ArgumentValue>#key#</ArgumentValue> <RequestId>Some requestid</RequestId> <HostId>some host id</HostId> <?xml version="1.0" encoding="UTF-8"?> <Error><Code>InvalidArgument</Code> <Message>Only one auth mechanism allowed; only the X-Amz-Algorithm query parameter, Signature query string parameter or the Authorization header should be specified</Message><ArgumentName>Authorization</ArgumentName> <ArgumentValue>#key#</ArgumentValue> <RequestId>Some requestid</RequestId> <HostId>some host id</HostId> 400 Bad Request <?xml version="1.0" encoding="UTF-8"?> <Error><Code>InvalidArgument</Code> <Message>Only one auth mechanism allowed; only the X-Amz-Algorithm query parameter, Signature query string parameter or the Authorization header should be specified</Message><ArgumentName>Authorization</ArgumentName> <ArgumentValue>#key#</ArgumentValue> <RequestId>Some requestid</RequestId> <HostId>some host id</HostId> 400 Bad Request

Here is my code:这是我的代码:

<cfset urlD="https://document-api.company-information.service.gov.uk/document/#documentID#/content">
<cfhttp urlD="#Url#" method="GET" result="takeDoc" resolveurl="Yes" timeout="999">
   <cfhttpparam type="HEADER" name="Accept" value="application/pdf">
   <cfhttpparam type="HEADER" name="content-length" value=93295 />
   <cfhttpparam type="HEADER" name="Authorization" value="#key#"/>  
</cfhttp>

<cfdump var="#takeDoc#">

Any ideas how to solve this final step?

I appears you are transmitting the value #key# as your Authorization instead of the value for the variable key.我似乎正在传输值 #key# 作为您的授权,而不是变量键的值。 try putting cfoutput tags around your cfhttp tags.尝试将 cfoutput 标签放在您的 cfhttp 标签周围。

暂无
暂无

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

相关问题 R:从Companies House API获取pdf文档 - R: fetching pdf documents from Companies House API 我正在尝试通过反应从 Api 获取数据,一个 api 取决于第二个的“id”, - I am trying to fetch data from Api with react, one api depends on "id" the second's one, 当我尝试通过表单中输入的数据来编辑API URL并从API提取数据时,代码不起作用 - Code is not working when i am trying to edit the API URL by data entered in form and fetch data from API 我正在尝试从 api 获取数据并将其显示在 DropDownButton 中。 问题是快照返回 null - I am trying to fetch data from the api and display it in a DropDownButton. problem is that snapshot is returning null 我正在尝试利用API,但不确定将附加到文档中需要调用什么 - I am trying to utilize an API but i am unsure what needs to be called to append to the document 我无法从此 API 获取数据。 这是代码 - I am unable to fetch data from this API. Here is the code 如何连接到公司大楼 API - 具有特定的 curl header 和 API 关键要求? - How to connect to the Companies House API - with specific curl header and API key requirements? 如何使用公司之家 0.1.2 python API 包装器来获取公司备案历史? - How to use companies-house 0.1.2 python API wrapper to get company filing history? 我正在尝试从api获取数据,但似乎无法正常工作 - I'm trying fetch data from an api but it seems to be not working 尝试从 api 获取和显示 pdf 文件时没有内容提供程序错误 - no content provider error when trying to fetch and display the pdf file from api
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM