kintone developer network

Download File

Follow

Download FileGET /file.json

Downloads files from an attachment field in an app.

URI

https://{subdomain}.kintone.com/k/v1/file.json

Request Parameters

The file is downloaded by sending the file key information of the attachment file. This file key though will first need to be obtained using the Get Record API.

Note that this file key is different from the file key obtained from the response when using the Upload File API.

PARAMETER VALUE REQUIRED DESCRIPTION
fileKey String Yes This is the value that is set on the Attachment field in the response data returned when using the Get Record API.

Sample Request using Query Strings

Query String

fileKey=20150417022053715283FF97DC413CBC4B7A41C

Request Header

GET /k/v1/file.json?fileKey=20150417022053715283FF97DC413CBC4B7A41C HTTP/1.1
Host: example.kintone.com:443
X-Cybozu-Authorization: a2ludG9uZTpkZXZlbG9wZXI=

The content-type header is not needed.

Sample Request using JSON

Request Header

GET /k/v1/file.json HTTP/1.1
Host: example.kintone.com:443
X-Cybozu-Authorization: a2ludG9uZTpkZXZlbG9wZXI=
Content-Type: application/json
Content-Length: 73

Specify application/json for the Content-Type.

 

Body

{  
    "fileKey":"20150417022053715283FF97DC413CBC4B7A41C"
}

Response

The MIME media type of the uploaded file will be stated in the Content-Type, and information of the file will be set inside the response body.

Obtaining the File Key

As explained earlier, you will need the file key of the file to use the Download File API. Use the Get Record API to retrieve record data including data of the attachment file. A response in the below form should show you what file key is needed to be used for the Download File API.

{  
    "record":{  
        "updated_time":{  
        "type":"UPDATED_TIME",
        "value":"2012-02-06T11:59:06Z"
        },
        "attached_file":{  
            "type":"FILE",
            "value":[  
                {  
                    "contentType":"text/plain",
                        "fileKey":"20150417022053715283FF97DC413CBC4B7A41C",
                        "name": "kintoneUpdates.txt",
                        "size": "25302"
                },
                {  
                    "contentType":"text/plain",
                        "fileKey": "20150417022159ECFC1223C4B34C939E1B9BD25",
                        "name": "APIUpdatestxt",
                        "size": "20311"
                }
            ]
        }
    }
}
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request
Comments