Posting form-data and binary data through AWS API Gateway - post

I'm trying to POST "mutlipart\form-data" to my EC2 instance through AWS API Gateway, but I couldn't find a way to this. There is a way to post data using "application/x-www-form-urlencoded" and Mapping Tamplate to convert it to JSON but still posting a binary data like an image file is missing I guess. Is there anything I'm missing ?
EDIT:
I have found another way:
I convert the image to base64 string then POST it as with content type "application/x-www-form-urlencoded". By this way I'm sending whole image as string. After I got the message I can convert it back to image in PHP. Only down side of this I could find is when I convert image to base64 its size gets a bit bigger. Other than that, I couldnt find any other downside. If there is could you please share with me ?

Api Gateway team here.
Binary data isn't supported at the moment, but it's on our backlog. Several customers have requested this.
Some customers have had success using the base64 util in the mapping templates which may get it working for you: http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#util-template-reference
Other than that you'll have to wait for official support.
Edit
Binary support is finally here!!

Related

Postman how to use Get Requests by read URLs from various .txt files

I hopefully have a simple request but unable to do by myself due Postman's
file support behaviour.
Case:
Lots of people creating simple URLs for a maschine learning tool and pushing them into a database.
The URLs got just simple differencies of an count up ID Number to request the appropriate information.
However, at the end of the day we got lots of simple single textfiles each
with 1 single url line.
What I just wanna do is to push the whole folder into Postman to finally test all created URLs and save the rsult as json...hm
Postman does not support textfiles and yeah thats crackbrained but I dunno how?
Any idea is welcome?
Thanks a lot in advance
brgds
You can export a Postman's Collection and see how the requests in it are exported (The JSON Format of a request is to be noted).
Now you know the format of a request, you can create a script that'll just run through all your files and basically generate a request out of each URL and add that to the exported collection's JSON.
Finally, import the collection back into Postman and you'll have all the requests ready to be tested out.

how to send image in messaging xmpp framework?

I'm sending only text, but I don't know how to send image/url, videos and integrate that in the chat application in iOS using XMPP.
I have refer so many questions but I want to send image using XEP-0363
I refer so many demo like monal app but any demo can't clear anything.
so
Please help me.
There are a few ways to send images, one way is to create an API, and create a function for uploading images. So when you want to send an image, you can first call your API function, which will upload the image and then return the URL of the image. You can then send the URL in the <message> stanza, possibly in your own custom tags.
For example,
<message to=""...>
<image>http://example.com/myimg.jpg</image>
</message>
Of course it will then be up to the client to download the image.
Another way to do it is to convert the image to a base64 string, and send the base64 string in the message stanza. However I actually do not recommend doing so, as the base64 string can be extremely large, and sending large packets through xmpp isn't a good idea. Particularly if you are in a group chat with a lot of users, in which case it will have to send the large packet to many users, wasting up valuable bandwidth, as well as server space for any offline-stored messages.
You could of course use XEP-0363 as mentioned, but you just need to make sure your XMPP server supports it.

Asana - Rest API - Multipart/form image upload times out

I am working on a little tool to upload issues found during development to Asana. I am able to get and use post to create tasks etc, but I am unable to do a proper multipart forum upload.
When I run my image upload post request through an independent perl based cgi script I am getting 200's back and an image saved on my server.
When I target Asana, I get 504 gateway timeouts. I am thinking there must be something strict that the perl script is letting through but I have malformed in my request but I am hard pressed to find it.
Is there a web expert or asana expert out there who might be able to help shed some light on what might be missing.
Note the wireshark capture has an extra field. The Asana docs indicate a task field I have tried with and without that field since it is unclear if the task id encoded in the url satisfies that requirement.
I found the problem!
My boundary= had quotes around the value which was getting through on my cgi / apache setup but not for asana.

Can CDNs handle base64 encoded data?

I'm trying to make an app where I take pictures from users add them to a canvas, draw stuff in them, then convert them to a base64 string and upload them.
For this purpose I'm considering the possibility to use a cdn but can't find information on what I can upload to them and how the client side uploading works. I'd like to be able to send the image as base64 and the name to be given to the file, so that when it arrives to the origin cdn, the base64 image is decoded and saved under the specified name (which I will add to the database on the server).Is this possible?Can I have some kind of save.php file on the origin cdn where I write my logic to save the file and to which I'll send XHR requests? Or how this whole thing work?I know this question may sound trivial but I'm looking for it for hours and still didn't find anything which explains in detail how the client side uploading work for CDNs.
CDNs usually do not provide such uploading service for client side, so you can not do it in this way.

EBAY - Sending a file via http post?

I've a file I want to send to the ebay system to support the LMS.
All the samples I've found include the use of the API, but the environment I'm working in doesn't have the ability to use it (the api).
So I'm forced to send the file with an HTTP post. But the doc's seem lacking.
Has anyone constructed/found an example of a HTTP post that will send a given file.
EDIT:
Oh.. what I see in the samples I have found is an area that seems it's supposed to have the data, but in the sample, there's nothing I'd consider real data.
Are you talking about the file transfer service or the bulk upload service? Don't you just generate an xml document and post the url like in this example:
http://developer.ebay.com/DevZone/file-transfer/CallRef/uploadFile.html#Samples

Resources