Input File

the input with format “file” allows the user to upload a file while executing the method

input file

file size is limited to 100Kb, because the content of the file is base64 encoded and passed as a variable

{
    "inputs": {
        "file": {
            "id": "file",
            "title": "Input file",
            "description": "The input file to be annotated",
            "minOccurs": 1,
            "maxOccurs": 1,
            "schema": {
                "type": "string",
                "format": "file",
                "contentMediaType": "text/plain",
                "default": ""
            }
        }
    }
}

to access the file content, it’s possible to decode it in the deploy script, using a comand like

echo {{file}} | base64 -d > /ccp_data/input

then simply read the file /ccp_data/input during the method execution

{
    "additionalParameters": {
        "parameters": [
            {
                "name": "deploy-script",
                "value": [
                    "echo {{file}} | base64 -d > /ccp_data/input"
                ]
            },
            {
                "name": "execute-script",
                "value": [
                    "wget {{baseurl}}/{{service}}?annotations={{annotations}} --post-file /ccp_data/input  -O /ccp_data/annotated.json"
                ]
            }
        }
    }
}

to work with bigger files, refer to the Input file workspace section

example: Python example