I have tried and searched but I haven't found any example or explanation on how to make a synchronous GET request to get a JSON for example. Only thing I found was ONE simple code for async request using SOUP, which actually worked, but it was async so of no use to me :/
I think SOUP can be used to make a synchornous request, but the way the gjs documentation works didn't help me to find out how.
So I figured, sure someone must know how to do this, he/she just didn't post it anywhere. Therefore I'm asking. Please, how do I do this?
OK, I have found a libsoup documentation for C that is actually usable, and used google site: search argument to find the GJS wrappers. And I made it work :)
Here is the example code I made, how I wanted. Hope it works for you too :)
const Soup = imports.gi.Soup;
let sessionSync = new Soup.SessionSync();
let msg = Soup.Message.new('GET', 'https://www.example.com/json?arg=something');
sessionSync.send_message(msg);
print(msg.response_body.data);
Related
I'm trying to handle a stripe webhook, I've used their examples for express, also tried everything found on github/stackoverflow, nothing seems to work.
After few days of trying different approaches proposed by others, I can't manage to make it working, I'm getting the same issue StripeSignatureVerificationError every-time, please let me know what I'm doing wrong.
Thanks!
Try once with this:
event = this.stripeClient.webhooks.constructEvent(
request.body,
request.headers["stripe-signature"],
webhookSecret
);
Can anyone help with using the Twitter API to upload a profile banner using the account/update_profile_banner? I have been searching on Google for so long and can't find any solution, thanks in advance
Based on https://gist.github.com/hayesdavis/97756
It looks like the docs are misleading, unless you are uploading a really small image, I expect it is critical to use multi part form data instead of encoding data in the query params.
Post your example code though, it's bad stackoverflow form to just say it doesn't work without showing the code and errors you are getting.
I am attempting to paste something to Pastebin using its API (http://pastebin.com/api). I was wondering if someone could quickly show me the proper format for pasting something (http://pastebin.com/api#2). I am doing this in Java, but that isn't very important.
Since posting the question, I have figured it out and created an API for this. https://github.com/nrubin29/PastebinAPI
The Red Cross has a locator page where you can submit a zip code by means of a form and that runs through a JSP to return contact information for your local Red Cross office.
From an iOS app, I have the user's zip code and would like to run this process and get that contact information back... or at least the appropriate URL to link to. I was hoping I could find some way to pass the zip code by URL but it doesn't look like it's going to be that easy.
Could anyone offer some direction as to how to go about this? I've done some simple things with forms before but I'm not quite sure where to start with this one.
According to the <form> action parameter, that's the URL you have to post your data to:
http://www.redcross.org//portal/site/en/template.MAXIMIZE/ziplocator/;jsessionid=MWwKPvjSWmvz8p4XrRtNLVL0VCTM7fcwfnFnKHpwRhJTnwLMMDcv!-1938881463!-1334769155?javax.portlet.tpst=2bd907ea326f7e9e934afa36c23f78a0_ws_MX&javax.portlet.prp_2bd907ea326f7e9e934afa36c23f78a0_viewID=result&javax.portlet.begCacheTok=com.vignette.cachetoken&javax.portlet.endCacheTok=com.vignette.cachetoken&vgnextoid=6d65e821cbdf9110VgnVCM1000002bf3870aRCRD
The field name is zipcode. The AFNetworking documentation is quite okay explaining how to send a POST request. I would also recommend the nsscreencasts series, he has an episode on AFNetworking as well.
I hope this helps. :)
You can use NSURLConnection to execute a post request and return the result, you may have to do some parsing of the result though depending on the format it is returned in.
Here is an example:
http://forums.macrumors.com/showthread.php?t=689884
NSURLConnection documentation:
https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/nsurlconnection_Class/Reference/Reference.html
I have tried to make a uploader using imageshacks API but I have not been successful, I don't get an error code so I don't know what the error is.
This is their documentation: code.google.com/p/imageshackapi/wiki/ImageshackAPI
I have a imageshack api key too.
These are some of the websites/codes I have tried:
http://codeemporium.com/2009/06/14/dot-net-c-sharp-wrapper-for-the-imageshack-xml-api/
But none of them have a direct code that I use without having to change most of the code, which I am not good with, I don't have experience with API's.
Edit: I still need help with it.
Thanks