Sign inSign up

blockaero/upload-endpoint

By blockaero

Updated about 6 years ago

Image
0

971

blockaero/upload-endpoint repository overview

Overview

This supports the upload of multi page PDF, single page PDF or single page image(png) files or single page txt.

Making changes and redeploying service

./deploy.sh DEV upload-endpoint

Testing endpoint without initiating the entire pipeline

//add the following header if you dont want the chaining action of the pipeline.
-H "strategy:{}"

DEV

//upload-endpoint_key.txt will be in the project root when you run the deploy script.
api_key="$(cat upload-endpoint_key.txt)"
//if you want to do only upload - without doing any further steps
 # only when you are uploading a known document type for specific situations
curl -v  http://localhost/function/upload-endpoint \
       --data-binary @page-12.pdf  \
       -H "customername:blockaero" \
       -H "filename:page-12.pdf" \
       -H "containername:sample"  \
       -H "X-Callback-Url: http://webhook/" \
       -H "X-Document-Type: vsl" \
       -H "X-Api-Key:$api_key"

PRODUCTION

//run the following script first.
./webhook.sh
//this would have created a public access webhook.
//Replace WEBHOOKURLPUBLIC with a public_url
//if you want to do only upload - without doing any further steps

curl -v  https://k8s.api.block.aero/function/upload-endpoint \
       --data-binary @P-1342MiniPack.pdf  \
       -H "customername:blockaero" \
       -H "filename:P-1342MiniPack.pdf" \
       -H "containername:sample"  \
       -H "X-Callback-Url: https://johnec123.free.beeceptor.com" \
       -H "X-Api-Key:727bb8fe5fc0cee3b3596795bb694a9a1d44e8708d55db7c824031297cd57809"

Expected Response

{
  "action": "upload",
  "endpoint": "upload-endpoint",
  "status": 200,
  "id": "85c4145a-fe93-11e8-b471-02420a00001a",
  "result": {
    "file_path": "BLOCKAERO/sample/85c4145a-fe93-11e8-b471-02420a00001a.pdf",
    "file_name": "85c4145a-fe93-11e8-b471-02420a00001a.pdf",
    "mime": "application/pdf",
    "file_type": "pdf",
    "page_count": 1,
    "file_size": 126642,
    "original_file_name": "sample.pdf"
  },
  "next_action": "pdfsplit_poppler",
  "total_time_taken": "0.06532597541809082",
  "next_action_response": 202
}

Tag summary

Content type

Image

Digest

Size

37.8 MB

Last updated

about 6 years ago

docker pull blockaero/upload-endpoint:a16559384be15ed4c5a33601187fb549df80e88b