[英]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.