Using libcurl to list IMAP Inbox - email

I'm running Xubuntu 13.04 and have the newest version of libcurl/curl installed:
$ curl -V
curl 7.29.0 (i686-pc-linux-gnu) libcurl/7.29.0 OpenSSL/1.0.1c zlib/1.2.7 libidn/1.25 librtmp/2.3
Using the following command I tried to list the mails in my Inbox
curl -u 'user:password' -X "EXAMINE INBOX" --url 'imaps://mymailserver.com:993/INBOX'
But instead I get only the body(text) of my first(oldest) email in the inbox. I tried some other commands as mentioned in this question. But every command returns the text body of my first mail. The same happens when I run the query via libcurl.

Curl has only limited support for IMAP until version 7.30. I have updated to 7.33 and now everything works fine.
I got the answer on the curl mailing list.

Related

How to channel originate SIP in Asterisk ARI?

I try to make call via Asterisk REST API, I want to make a call like this (CLI command example):
channel originate SIP/4444#sipprovider application playback tt-monkeys
I try to use curl for that:
curl -v -u admin:pass -X POST "http://127.0.0.1:8085/ari/channels?endpoint=SIP/1000&extension=4444&context=sipprovider"
When I post the request I get this error:
Allocation failed
What did I do wrong?
If I try using SIP, I get the same error. You might have PJSIP enabled instead of SIP.
Try using PJSIP instead of SIP.
Example:
curl -v -u asterisk:asterisk -X POST "http://localhost:8088/ari/channels?endpoint=PJSIP/5001&extension=5002&context=internal"

Sending mail with curl on Windows via MS Exchange Server

I am trying to send an email using curl on Windows 10 through an MS Exchange Server. The email is sent to another user in the same Active Directory domain, and the user who is sending the email is already authenticated under Windows.
Given the above, I can successfully send an email using telnet as follows:
or PowerShell as follows:
Given that the above two commands work, I am looking for the equivalent curl command. I have looked at the following SO answer:
Using curl to send email
and tried the following command (and many other combinations of options), but with no success.
curl -v --url "webmail.jXs.com:25" --mail-from "r#jXs.com" --mail-rcpt "s#jXs.com" --upload-file mail.txt
I get the following output:
where the mail.txt file is:
So, what is wrong with my curl command? Thanks.
Apparently when using curl, we have to specify the smtp communication protocol in the url (which is not necessary when using telnet or powershell). So, adding smtp:// to the url made the curl command work.
curl -v --url "smtp://webmail.jXs.com:25" --mail-from "r#jXs.com" --mail-rcpt "s#jXs.com" --upload-file mail.txt

Is it possible to run a curl command with a splunk dbxquery?

I am developing a dashboard that connects to Splunk via REST API and displays data on various charts/graphs etc. In order to get the data I have to make a POST request via curl (node.js). Everything is working great. However when I try to make a Post request with a dbxquery, it fails and returns 'fatal dbxquery unknown command.' I was wondering if anyone had encountered this before.
curl -H 'Authorization: Basic auth token' -k https://devfg.com:8089/services/search/jobs -d search=" | dbxquery query=\"SELECT count(*) FROM db.table\" connection=\"connection\"" -d output_mode=json
Are the permissions for the dbxquery command set to be executable from any app? Check under app permissions to see if the command is globally exported.
Alternatively, you may need to escape the *, so \*.
Otherwise, you should be able to run the dbxquery via a curl command.

Example REST Extension does not xdmp:log anything when invoking POST

I trying to debug a REST extension in MarkLogic by using xdmp:log() inside the XQuery. Seems I am having some issues invoking a POST call in general actually...? Bit confused now.
I use the exact example code as from the MarkLogic documentation here
I installed it via Roxy > deploy > ext
It is there when I look into http://host:port/v1/config/resources
The PUT command provided in the doc works and returns the "Done".
But I cannot get the POST statement to dump the xdmp:log messages in the errorlog.txt on the server?
I tried several curl commands:
curl --anyauth --user admin:admin -X POST http://host:8040/LATEST/resources/example
curl: (52) Empty reply from server
Question: What is the correct curl command to trigger the examples POST functon so something shows up in the log?
This is a curl issue. You need to specify a request body for curl to send.
curl --anyauth --user admin:admin -X POST -d '{"key":"value"}' http://host:8040/LATEST/resources/example
Or if you want to send an empty body just do this:
curl --anyauth --user admin:admin -X POST -d '' http://host:8040/LATEST/resources/example

curl with REST API

I want to test an API using curl for Mac.
According to the REST API documentation/forums, the URL should look like this:
http://localhost:8080/sdpapi/request/?OPERATION_NAME=ADD_REQUEST&<your API key>&<Operation> <Details><requester>Me</requester><subject>Test</subject><description>Testing Curl Input</description></Details></Operation>
Here is what I have come up with for the curl command line input:
curl -X POST -d "OPERATION_NAME=ADD_REQUEST&TECHNICIAN_KEY=0...87&INPUT_DATA=<Operation><Details><requester>Me</requester><subject>Test</subject><description>Testing curl input</description></Details></Operation>" http://myserver.mydomain.org/sdpapi/request/  
I haven't tried it yet because I am BRAND NEW to this and I'm sure there are problems. Does this look OK and should I give it a whirl?
Figured it out: curl -d "OPERATION_NAME=ADD_REQUEST&TECHNICIAN_KEY=xxxxxxxxxx&INPUT_DATA=TestData.xml" http://xxx.xxx.xx.xx/sdpapi/request/