HTTP Web Service call using C language - c

Which are libraries available to get the URL response using C/C++ language?At present I am searching for GSOAP library for C/C++ but can not find proper solution.

If you are just going to retrieve a URL response, the curl lib will do the job. If you are specifically dealing with SOAP, then another library will be necessary to parse the response (or a standalone library may be used to do the retrieval + response parsing all at once).

Related

Module chaining in NGINX

I'm writing a NGINX module in C that requires access to Redis.
To make those calls non-blocking, I want to use asynchronous access to it (either with official C API for Redis or using redis2-nginx-module).
I've read Emiller's Guide and it seems to me that I need to build a "chain" of modules. Something like:
My module parses HTTP request, makes corresponding request to the other module, that works with Redis asynchrounously, as "upstream"(?)
On the Redis response, the control is being returned to my module and it finalizes HTTP response, sending data back to server.
What I don't get is how to implement those chains? I hardly can find the good example, all builtin NGINX modules seem to redirect control to itself (u = r->upstream;) ? Any way to specify other module as an upstream?
Appreciate your help with a good code example of chaining.
Finally I decided to partially implement the logic using LUA interface (http://wiki.nginx.org/HttpLuaModule + https://github.com/openresty/lua-resty-redis).
It basically works in non-blocking way using nginx subrequests but provides much easier way to write the module.
Part of the logic (handler-based) I implemented using C modules.

Can the accept header be changed through the PHP library?

We are using the Consolibyte QuickBooks Online API PHP Library and are retrieving the raw response that we provide/bounce to a client. The response is currently in XML format, we'd like it to be JSON to make the transaction faster.
Can the Accept header be application/json? Or the library only supports XML?
Currently we only support XML. We don't support JSON quite yet.

authentication/http headers support in forge.file trigger.io module?

in the official trigger.io docs there seems to be no provision for custom http headers when it comes to the forge.file module. I need this so I can download files behind an http authentication scheme. This seems like an easy thing to add, if support is not already there.
any workarounds? any chance of a quick fix in the next update? I know I could use forge.request instead, but I'd like to keep a local copy (saveURL).
thanks
Unfortunately the file module just uses simple "download url" methods rather than a full HTTP request library, which makes it a fairly big task to add support for custom headers.
I've added a task to our backlog for this, but I don't have a timeframe for it being added.
Currently on iOS you can do basic auth by using urls in the form http://user:password#url.com in case that helps.
Maybe to avoid this you can configure your server differently, or have a proxy server in front that allows you to pass authentication details as get parameters?

Why can't api method names contain underscores?

My method names get translated from some_method to apiname.resource.somemethod and gapi.client.apiname.resource.somemethod. Example:
#endpoints.method(messages.VoidMessage, messages.VoidMessage,
name='resource.some_method', path='resource/some_method' )
def resource_some_method(self, request):
pass
I've also tested by naming a method with a few underscores in between.
Can this be stopped?
No. Google's API Infrastructure has strict naming guidelines and these are "enforced" by the SDK code. When deploying your application, your API definition is translated into an API configuration file which is sent of to Google's API Infrastructure to spin up a Discovery-based API of your very own.
Before creating this API config, these names are parsed by the endpoints.message_parser library (called from endpoints.api_config) to make sure your names adhere to the specification. In particular:
split_name = re.split(r'[^0-9a-zA-Z]', name)
normalized = ''.join(
part[0].upper() + part[1:] for part in split_name if part)
You are free to circumvent this code and generate your own API configuration, but the API deployment will fail as those names will be rejected by Google's API Infrastructure when you deploy.

First Box.com integration. How do I query for a list of folders?

I have the oAuth stuff working as expected. No challenges there. I now need to use the access token to do something. Nothing I have tried works. I'm sure it's very simple, but I am not sure how to translate the examples in curl to http post/get requests.
Box.com help says:
curl https://api.box.com/2.0/folders/FOLDER_ID \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
How do i write that using http post/get?
As long as the requests are being sent via standard http functionality I don't believe my platform matters. Regardless, I'm using Apex to write this in Salesforce.com.
Note: I know there is an app on the AppExchange to integrate Box.com and Salesforce. For my purposes I don't want to rely on apps that are unique to a specific platform.
Any help is appreciated.
It's simply a GET request with headers and optionally XML / JSON as POST payload, not sure what's your specific problem? Have you actually tried writing some code?
Simple example: http://www.salesforce.com/us/developer/docs/api_asynch/Content/asynch_api_quickstart_login.htm
Bit more advanced: http://developer.force.com/cookbook/recipe/scheduling-an-apex-call-from-the-command-line
CURL is a powerful tool and the list of it's commandline options is not for the faint of heart. Still - use it as a reference, especially "-H" meaning HTTP header. I think the "\" is just indicating that it's a multiline command, you can ignore it.

Resources