-
Notifications
You must be signed in to change notification settings - Fork 112
Multipart Requests
idralyuk edited this page May 18, 2012
·
1 revision
Multipart requests (RFC1341) are commonly used to upload binary attachments. ql.io supports such requests and allows forwarding of attachments to downstream services. When ql.io receives a multipart request, it treats the first part as the body of the message and the remaining parts as attachments.
Here is a sample table definition (omitting the flickr authentication parameters):
create table flickr.upload
on insert post to "http://api.flickr.com/services/upload/"
resultset 'photoid'
This route will forward the first three attachments to the flickr photo upload service:
return insert into flickr.upload with parts "{req.parts[0]}", "{req.parts[1]}", "{req.parts[2]}"
via route '/flickr/upload' using method post;
POST /flickr/upload HTTP/1.1
Content-Type: multipart/form-data; boundary=---------------------------7d44e178b0434
Host: localhost
Content-Length: 42001
-----------------------------7d44e178b0434
Content-Disposition: form-data; name="body"
Sample Request
-----------------------------7d44e178b0434
Content-Disposition: form-data; name="photo"; filename="C:\test.jpg"
Content-Type: image/jpeg
{RAW DATA}
-----------------------------7d44e178b0434--
The following content types are currently supported by ql.io
multipart/form-data
multipart/related
multipart/mixed