curl+jq

Use .netrc

Save access to CouchDB servers using .netrc files.

Use .curlrc

At least add -n. Using -s is probably a good idea in scripts.

CDR search

For example, looking for CDRs for 33972470000:

curl --get \
  -d include_docs=true \
  -d 'startkey=["33972470000"]' \
  -d 'endkey=["33972470000",{}]' \
  'https://example.net:6984/cdrs/_design/kwaoo/_view/cdr_by_number'

Filtering CDRs

Take the output from the preceding curl request, pipe it to:

jq -c '.rows[].doc | select(.variables.ccnq_direction == "egress" )| {_id,to:.variables.ccnq_to_e164,cause:.variables.hangup_cause}'

Then grep the output for the desired value.

Written on December 24, 2014