Libcurl using C - c

I have created a database using Berkeley DB in C. Now I want to use a libcurl function to send the entries in the database to a server. Can anyone suggest me good examples to read which address somewhat similar scenarios or any other material. I researched a bit and the libcurl homepage has some examples, but I am not able to understand them properly, how to use it in my context. I need examples only for "C" language. thanks in advance.

See the libcurl tutorial for a overview of libcurl, You may also want to look at the easy api reference, as that's what you'll most likely be using

Related

API-Call Example with Postman or Fiddler

I tried the installation with Docker and Kiwi TCMS and it worked wonderfully. Unfortunately, I have a lot of trouble with API calls. I tried several times without success to import the example Perl script from the documentation (https://gist.github.com/atodorov/f5aed028b6f254d97bcaf93453abe8d2).
Does an example(API-Call) exist without a Perl script (for Postman or Fiddler)? I would like to permanently update existing data with .NET environment.
Thanks :-)
The script in the gist is Python, not Perl.
For .NET I can't help you because I've never written a single line of code in .NET. Maybe somebody else can.
See if you have ready libraries for making XML-RPC calls or JSON-RPC calls. This is very common so I imagine there are such libraries. Then you will need to execute the method names described in out API docs.
In any case if someone is using .NET, or any other language for that matter please contribute your scripts/snippets to https://github.com/kiwitcms/api-scripts so we can build a shared knowledge base.

using swagger documentation or Hydra:ApiDocumentation for newly API

I am currently in the process of choosing a technology/format to expose my API. It seems there are lots of discussion on this topic, but could not find the one for future use. I am planning to use Hydra:
http://www.markus-lanthaler.com/hydra
as it seems to be fully restfull (hypermedia api) but it seems it is not accepted yet (neither HAL is).
when I go to : http://www.markus-lanthaler.com/hydra/api-demo/vocab, I get a json that seems to be what swagger returns.
my questions:
- is Hydra Documentation meant to be sthg like swagger
- could find any tool for it like swagger has.
- I would prefer using Hydra as it seems it has more description on operations... by using json-ld, but it does not seem to be as supported as Hal or swagger is.
-does anyone have experience with hydra
Great that you consider using Hydra. You are right, we do not have extensive tooling yet but that's just a matter of time. In fact, I'm already working on a documentation generator. If you have further questions regarding Hydra, please don't hesitate to post to our mailing list. There are a lot of people on that list that will be happy to help.

How to list the namespaces of a Citrusleaf/AeroSpike host?

I want to list the namespaces on a host remotely using the C# Client SDK, and the documentation is very scarce about it.
I am aware of a server tool to do this but I need to query that from a maintenance tool that I am writing, so using the server console is not an option.
Does anybody know if this is possible and if so how to do it?
You can make an info call with the string "namespaces" and parse the returned value.
doc on c# info API: http://www.aerospike.com/apidocs/csharp/html/Methods_T_Aerospike_Client_Info.htm
You can get that information by emulating the logic that clmonitor utilizes to communicate with the Aerospike cluster. Clmonitor is written in Python; executing the 'info' command in clmonitor provides a wealth of information, a subset of which is the list of namespaces. I suggest that you emulate the logic used by clmonitor in your C# code to communicate with the cluster and then parse out the information that you require. In the future, I suggest that you take advantage of the Aerospike forums to ask questions about Aerospike. Thank you for your interest in Aerospike.

GAE Go Json-RPC call example

I'm trying to understand how to use Json-RPC calls in Google Go that would be used in a Google App Engine app. So far I understand that I somehow should call rpc.Client.Dial, but I don't understand what the "network" and "address" parameters should be. Can anyone provide a sample, working code that demonstrates how to use Json-RPC in Go?
I have already written an answer to your question on the go-nuts group, but for completeness, here it is:
Go's jsonrpc package isn't compatible with GAE yet.
Reference: https://groups.google.com/d/msg/google-appengine-go/uQ0cv0m9j0E/H3VCrFgEWvcJ
It's probably a good idea to read the full thread there, since it describes the limitations on GAE nicely and links to a patched library with lots of workarounds... The issue is already known, but has not been solved yet.

How to wrap a C library so that it can be called from a web service

We have a library with very complex logic implemented in C. It has a command line interface with not too complex string-based arguments. In order to access this, we would like to wrap the library so that it can be accessed with simple XML RPC or even straightforward HTTP POST calls.
Having some experience with Java, my first idea would be
Wrap the library in JNI/JNA
Use a thin WS stack and a servlet engine
Proxy requests through Apache to the servlet engine
I believe there should already be something simple that could be used, so I am posting this question here. A solution has the following requirements
It should be deployable to a current linux distribution, preferrably already available via package management
It should integrate with a standard web server (as in my example Apache)
Small changes to the library's interface should be manageable
End-to-end (HTTP-WS-library-WS-HTTP) the solution should not incur too much overhead, but reliability is very important
Alternatively to the JNI/JNA proposal, I think in the C# world it should not be too difficult to write a web service and call this unmanaged code module, but I hope someone can give me some pointers that are feasible in regards to the requirements.
If you're going with web services, perhaps Soaplab would be useful. It's basically a tool to wrap existing command line applications in SOAP web services. The web services it generates look a bit weird but it is quite a popular way to make something like this work.
Creating an apache module is quite easy and since your familiar with xmlrpc you should check out mod-xmlrpc2. You can easily add your C code to this apache module and have a running xmlrpc server in minutes
I think you may also publish it as a SOAP based web service. gSoap can be used to provide the service interface out of the library. Have you explored gSOAP? See http://www.cs.fsu.edu/~engelen/soap.html
Regards,
Kangkan
Depends what technology you're comfortable with, what you already have installed and working on your servers, and what your load requirements are.
How about raw CGI? Assuming the C code is stateless between requests, you can do this without modifying the library at all. Write a simple script which pulls the request parameters out of the CGI environment, perhaps sanitises the input, calls the library via the command-line interface, and packages the result into whatever HTTP response you want. Then configure Apache to dispatch the relevant URL(s) to this script. Python, for example, has library support for XML-RPC, and so does every other scripting language used on the web.
Servlets sound like overkill, but for instance if you want multiple requests per CGI process instantiation, and don't feel like getting involved in Apache configuration, then it might be easiest to stick with what you know.
I'm doing a similar thing with C++ at the moment. In my case, I'm writing a PHP module to allow PHP scripts to access the logic in my C++ library.
I can then use whatever format I want to allow the rest of the world to see it - initially it will just be through a PHP web application but I'll also be developing an XML-RPC interface.
If you're going down the JNI route, check out SWIG.
http://www.swig.org/Doc1.3/Java.html
Assuming you have headers to project bindings with, swig is pretty easy to work with.

Resources