Hi,
I have an API that requires the request to accept gzipped encoding.
I played around with headers (such as accept-encoding: gzip, deflate; etc.) - no luck (just really long hang times).
Any way to do this?
Thanks,
P
Hi,
I have an API that requires the request to accept gzipped encoding.
I played around with headers (such as accept-encoding: gzip, deflate; etc.) - no luck (just really long hang times).
Any way to do this?
Thanks,
P
Bumpā¦
Did you get things to work in postman?
Yes.
.
So can you share a screenshot and your settings in Bubble?.. Thatās how to do it, you replicated in the API connector what you have in Postman.
Postman handles GZIP encoding, Bubble doesnāt or doesnāt seem to - this is what I want to know from you⦠Does Bubble handle GZIP encoding or not? If not, can you enable it? If not, is there a workaround?
No ability to post a screenshot just now but no point - all I get from Bubble is error message saying data is Gzipped. Can follow up later with a screenshot if you still think itās important.
P
Do you have a link to the doc of the API?
The documentation is in my account (not documented outside the account), so Iāll just share what it says, itās extremely simple.
It reads:
"CSV or JSON from the last run
Use the following RESTful API to download data from your last successful Extractor run in CSV or JSON format. Please do not share your API key with anyone."
Thatās it - you get an API address (https://data.import.io/extractor/[long code for this particular extractor]/json/latest?_apikey=[enter key] and youāre done. [Note: if you want a CSV download instead of JSON data you just change the ājsonā in the API to ācsvā. Iād like the JSON]
Iāve successfully used this in Postman and another platform (Built.io). Both Postman and Built.io have Accept-encoding: gzip enabled so it was easy to get it working. I have not been able to get it working in Bubble.
Anyway, hope this helps? Let me know if you need anything else to investigate this.
Thanks,
P
And can you share a link to your app with some credentials to test? Itās likely a feature request, not a bug, so we canāt guarantee we can add it.
@emmanuel seems like you never got a link on this question. I have the same problem with import.io. It runs in Postman but bubble gives me error.
Here is a link:
Any suggestions?
I solved it by using different product: Import.ioās āMagicā which doesnāt seem to require gzip or at least it worked there.
just wanted to check if this was resolved?
I am using API calls via a plug-in in Bubble to connect to our own system. The integration broke a few days ago and I have traced it to a change in the way the API sends responses. A change was made to the API where the response JSON is gzip compressed. Now in Bubble I get an error like this:
What caused me a bit of confusion initially was that the first thing I did was check Postman, but it turns out that Postman transparently unzips the compressed response.
Is there anything I can do or set in Bubble so that the API calls can work with the compressed response?
further to my last post here are the screenshots from Postman, showing a nicely formatted JSON response and the headers of the response indicating the gzip compression.
Same issue here and with another recent poster API response in gzip format
I have an API which is encoded in gzip which Bubble does not support. Postman will show the content just fine with Content-Ending as gzip.
@emmanuel Can we request gzip support in the API Connector data types
If anybody, is still looking for the possible solution to bubble limitation. I will share a solution for this.
Make sure that you set the Action Type as āServer sideā
Add the following code inside the code section
function(properties, context) {
const options = {
uri: āā,
gzip: true, // !! This is important needed for unzipping !!
method: āGETā, // or POST, depending on the needs
headers: {
ā¦},
body: āā // if POST is used
}
response = context.request(options)
if (response.statusCode == 200) {
json = JSON.parse(response.body)
return {
your_property1: json.<fieldName1> , your_property2: json.<fieldName2>
};
}
// if you want to return http error code and message as property values. For this you need to define this properties in return values section
return {http_status_code: response.statusCode, http_error_message: response.body}
}
You include the plugin in your application. Then you can add the action anywhere with plugins->
The result of the action with the all the result properties <your_property1>,<your_property2>, etc is available for the next actions with āResult of step nā.
Forgot to say that you can get and use the API call parameters from the UI when you are describing the properties in the āFieldsā part of āPlugin actionā
P.S. I think that this approach is pretty much similar what bubble does with API Connections in plugin builder. If it is true, I wonder why bubble does not support gzipped results.
Hey Serg,
Thank you for sharing your solution to this gzip decompressing issue. I really hope @emmanuel and the Bubble team can quickly create a solution for this (seems like a relatively straightforward update for them to add gzip support to their api connection plugin, but I could be wrong).
I tried using your code to create a gzip solution of my own. Iām still getting an error thrown however.
Would you mind taking a look to see if thereās any error in my code. It looks fine to me as far as what I can tell.
function (properties, context) {
const options = {
uri: "https://www.parsehub.com/api/v2/projects/{PROJECT_TOKEN}/last_ready_run/data?api_key={API_KEY}&format=json",
gzip: true,
method: "GET",
headers: {},
body: ""
};
response = context.request(options);
if (response.statusCode == 200) {
json = JSON.parse(response.body);
return { strains: json.strain };
}
// if you want to return http error code and message as property values. For this you need to define this properties in return values section
return {
http_status_code: response.statusCode,
http_error_message: response.body
};
}
Big thanks,
Jaime
Hi Jaime,
If these steps will not solve your problem, just debug the logic with putting console.log(āā¦ā)-s to see what and where things fail. You will see the log messages in the logs of the application which is using the plugin. Make sure that will use the latest version of the plugin with the application.
Important! Please remove the sceenshot from your post because it leaks some info that people should not see
Hey Serg,
I think I am throwing a return value (see line 15). I wrote āreturn { strains: json.strain };ā
Is that not correct? Let me know if I need to maybe move the return statement somewhere else.
Thatās odd, looks like the forum didnāt update my photo hiding my api key. Thanks for the catch there! (donāt want that info leaking out )
For sure, great idea with using console.log to debug the logic. Itās been a while evidently since Iāve coded in JavaScript. Your help is much appreciated
What I meant was to add strains in return values section as seen in the screenshot
Please add http_status_code, http_error_message as well. At the moment I cannot verify whether the absence will cause an error or not, but without them you wonāt be able to access the values after the plugin action is finished
Weāre going to work on this next week