File uploaded to presigned URI, request response 200. But when using assetID for further API call - response 'Asset not found'. Adobe PDF services API - postman

Using Adobe 'PDF services API'
Generated AssetID and presigned URI using https://pdf-services-ue1.adobe.io/assets API.
Got following as response.
{
"uploadUri": "https://dcplatformstorageservice-prod-eu-west-1.s3-accelerate.amazonaws.com/16a9de6d208743239d1f694295f12626_254127B763EDC88B0A495FC7%40techacct.adobe.com/9fea6bbd-4f94-40d2-8463-d4e94aaa8424?X-Amz-Security-Token=FwoGZXIvYXdzEAIaDIBucznIV%2BQEMQw0PCLTAczK0ByJ4MmpHzLcmN3VNzE%2Fuhh2sH3Xw7009oBaypEOWod2yD%2FtfwLKFwS8Lq0sSmXyJFpd4vU67PaHAUdtxuJt4vXIaL9t%2FNFtTy66TZz4lTD4rRQQP%2BgJNO6C7f3JOlVeIyVTSyGieQ3jXSwkctCHmAA7YeWqKutr83tCUPeVzrPRyqNOx7BMA6vQUSpTelIVvY9F67s0IOYtuETwZeE0XFh%2BfKA%2FeN3rEdRGqqq60aUVNQTZZCnqInpFHQ8xu%2FcQM6fFPnUO79IVUC7fqpV4xMson7bHnwYyLThcwrmnyKJyCNvmZwl%2BNUbkpVMmY0lCcMMTtXYRtxxTV8yYq7zzcTWicI6XBA%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20230219T082707Z&X-Amz-SignedHeaders=content-type%3Bhost&X-Amz-Expires=3600&X-Amz-Credential=ASIAWD2N7EVPJNDYTYLB%2F20230219%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Signature=c291f06087e85b5221e2910aba53bf4ce40e12542e800c7f159f009d3bfa94c6",
"assetID": "urn:aaid:AS:EW1:2ceb2ab0-e94b-4664-9bfa-0789e3fe111d"
}
Then uploaded PDF file to URI by making a PUT request with URI as the endpoint and uploading the file in binary in body. The response status of this request is 200 OK.
Then used the assetID for making a POST request 'https://pdf-services-ue1.adobe.io/operation/exportpdf'.
Can someone explain why 'asset not found', when PDF file successfully uploaded to presigned URI.
I tried to convert PDF to docx using adobe pdf services API, by making API calls using postman.
But got error 404 'Assset not found', despite pdf file being successfully uploaded to the presigned URI.

Related

AWS Lambda Authorizer not allowing application/zip response after successful authorization

I have an GET API created which uses nodejs lambda to return a zip file with base64 encoding and content-type - application/zip. And it is working fine by downloading zip file while hitting from browser or postman when it doesn't configured with any authorizer.
But when I add an authorizer to this API, I am not able to see this zip file downloaded instead getting as json response where the response header sets content-type to "application/json".
{
"statusCode":200,
"isBase64Encoded":true,
"body":"UEsFBgAAAAAAAAAAAAAAAAAAAAAAAA==",
"headers":{
"Content-Type":"application/zip, application/octet-stream",
"Content-Disposition":"attachment; filename=Testfile.zip",
"Content-Encoding":"base64"
}
}
How to get the result in the same way i.e. getting zip file downloaded?
I changed the api integration type to lambda-proxy instead of lambda.
This solved my issue and able to download the binary file.

415 unsupported media type content-type application/pgp-encrypted while sending POST message

I'm working in REST API development project. The client have provided the OpenAPI specification for the API which they are expecting.
We have used the openAPI generator cli to generate the API from the OpenAPI specs given by the client.
Following are the two APIs
1. /requestFile:
This API is expected to accept JSON payload and produces payload of content type application/pgp-encrypted.
We have annotated the API as below.
#postmapping(value="/requestFile",consumes={"application/json"},produces={"application/pgp-encrypted"})
The expectation is to transfer a PGP encrypted JSON file as a response to the POST message.
I'm not sure how to transfer the PGP encrypted file as a response, I have searched for some references but most of them are using maultipart file to transfer binary files. Whereas the content type of multipartfiles is not same as "application/pgp-encrypted".
I need some help in transferring this pgp encrypted file as a response to the POST message via REST API.
2. /feedback
This API consumes payload of type application/pgp-encrypted and produces a simple http response code back to the client. We have annotated the API as below.
#postmapping(value="/feedback", consumes={"application/pgp-encrypted"})
When I try to send a POST message using POSTMAN with content type application/pgp-encrypted, we are getting a 415 unsupported mediatype error.
I need to understand how do we send pgp-encrypted file as a payload via POSTMAN and what is the content type I must use to achieve this.

How to configure AWS API Gateway to get a pdf response?

Response from server which works wellPDF is received from the server with response headers
Content-type: application/pdf
and
Content-dispositon : attachment
whereas from API Gateway the PDF response gets corrupted with a change in file size as well. I was able to configure Method Response to application/pdf. Though I still have no solution for content disposition header which does not appear in the response header of API Gateway.
Response from API Gateway
Content-Disposition comes empty too

MS GRAPH API Upload v1.0 endpoint corrupts DOCX

Was trying to upload docx files through a golang server using MS graph API, and although I was able to upload pdfs, when I tried uploading docx files the files were being corrupted when sent over. If I upload the same file through the OneDrive website, there would be no problems.
To isolate the issue I tried making the API calls through postman using a link like:
https://graph.microsoft.com/v1.0/users/pqv2-dev-svc#novacoast.com/drives/{drive-id}/items/{item-id}:/filename.docx:/content
used a bearer token.
the additional header of Content-Type of which I have tried the values:
text/plain
application/x-www-form-urlencoded
application/vnd.openxmlformats-officedocument.wordprocessingml.document
and uploaded the file with the form-data option under the body tab but with no luck, the file always gets corrupted.
Any ideas?
[Resolved] Was sending file as form-data instead of binary!

S3 presigned upload url error

I am trying to perform a document upload using an S3 pre-signed PUT url. I generated the url using java AWS SDK (GeneratePresignedUrlRequest.java). This url generation code sits in a lambda function behind AWS API gateway.
However I am getting the following error when I copy the generated url in Postman & try to perform an upload.
<Error>
<Code>AccessDenied</Code>
<Message>
There were headers present in the request which were not signed
</Message>
<HeadersNotSigned>host</HeadersNotSigned>
<RequestId>6E624EC66091A099</RequestId>
<HostId>
9HnUUZpa9zUWfyzuNrZtRkoN2CYxH8V6rqx5QgsMFC6foTZKuG5qmZL5ThnUXooYPk2reFzKKUg=
</HostId>
</Error>
The generated url is "https://<bucket>.s3.amazonaws.com/<key>?X-Amz-Security-Token=<value>&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20180718T013339Z&X-Amz-SignedHeaders=content-type%253Bhost&X-Amz-Expires=1799&X-Amz-Credential=<value>&X-Amz-Signature=<value>
Any suggestions as to what needs to be corrected here in the generation of url ?
The error was indeed related to a 'missing header', but not 'host' which was misleading. The value 'content-type' that comes before 'host' in X-Amz-SignedHeaders=content-type%253Bhost , needs to be explicitly provided as a request header when a http client uses the pre-signed url to upload a file to S3.
I had generated the pre-signed url in java as
GeneratePresignedUrlRequest generatePresignedUrlRequest = new GeneratePresignedUrlRequest(bucketName,objectKey).withMethod(HttpMethod.PUT).withContentType("application/pdf").withExpiration(expiration);
So S3 expects content-type with value 'application/pdf' to be part of the pre-signed url request as a header for a signature match as I understand.