All Projects → Ericsson → jaq

Ericsson / jaq

Licence: Apache-2.0 license
jaq is a CLI tool for scripting and chaining JSON API requests.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to jaq

json-api-react-redux-example
React Application With Redux And JSON API
Stars: ✭ 25 (-41.86%)
Mutual labels:  json-api
bts-ce-lite
BTS-CE-Lite (Boda-Lite) is a cross platform vendor and technology agnostic telecommunication network management desktop application
Stars: ✭ 24 (-44.19%)
Mutual labels:  ericsson
JSON-API-Client
Abstract client-side php implementation of the json api specification (jsonapi.org)
Stars: ✭ 17 (-60.47%)
Mutual labels:  json-api
BarterOnly
An ecommerce platform to buy or exchange items at your convenience
Stars: ✭ 16 (-62.79%)
Mutual labels:  json-api
rjsonapi
⛔ ARCHIVED ⛔ Consumer for APIs that Follow the JSON API Specification
Stars: ✭ 29 (-32.56%)
Mutual labels:  json-api
QuranJSON
Simplified Perfect Complete Quran JSON (Indonesia Translation, Tafsir, and Audio) with API
Stars: ✭ 83 (+93.02%)
Mutual labels:  json-api
example-golang-todo
Golang API backend powering a TodoList app
Stars: ✭ 33 (-23.26%)
Mutual labels:  json-api
format-to-json
An algorithm that can format a string to json-like template. 字符串JSON格式化的算法。
Stars: ✭ 30 (-30.23%)
Mutual labels:  json-api
go-json-spec-handler
Simple JSON API Spec Compatibility in Golang
Stars: ✭ 41 (-4.65%)
Mutual labels:  json-api
php-json-api
JSON API transformer outputting valid (PSR-7) API Responses.
Stars: ✭ 68 (+58.14%)
Mutual labels:  json-api
jsonapi
(Official) Saferpay JSON API documentation, help and examples.
Stars: ✭ 22 (-48.84%)
Mutual labels:  json-api
QuickLearn
A collection of resources categorised by tech domains, languages, expertise and much more. QuickLearn gives you a quick access to all the resources that you could need at a single place, within a click!
Stars: ✭ 89 (+106.98%)
Mutual labels:  json-api
drf-json-schema
Extensible JSON API schema for Django Rest Framework
Stars: ✭ 15 (-65.12%)
Mutual labels:  json-api
ck-crowd-scenarios
Public scenarios to crowdsource experiments (such as DNN crowd-benchmarking and crowd-tuning) using Collective Knowledge Framework across diverse mobile devices provided by volunteers. Results are continuously aggregated at the open repository of knowledge:
Stars: ✭ 22 (-48.84%)
Mutual labels:  json-api
yin-middleware
Integrate Woohoo Labs. Yin into your application!
Stars: ✭ 14 (-67.44%)
Mutual labels:  json-api
json-api-response-converter
Normalize your JSON:API response
Stars: ✭ 21 (-51.16%)
Mutual labels:  json-api
bolaget.io
RESTful(ish) JSON API for Swedish alcohol monopoly, Systembolaget. Running on preemptibles on k8s! 🚀✨🍺
Stars: ✭ 27 (-37.21%)
Mutual labels:  json-api
homebrewhub
A showcase/archive of homebrews, patches, hackroms for old consoles. Provides community submission, tagging and rating features.
Stars: ✭ 36 (-16.28%)
Mutual labels:  json-api
api
_api is an autogenerated CRUD API built on LowDB and ExpressJS.
Stars: ✭ 73 (+69.77%)
Mutual labels:  json-api
DummyJSON
DummyJSON provides different types of REST Endpoints filled with JSON data which you can use in developing the frontend with your favorite framework and library without worrying about writing a backend.
Stars: ✭ 213 (+395.35%)
Mutual labels:  json-api

jaq

CLI tool for chaining JSON API requests.

Build Status

jaq simplifies running multiple, related API commands such as getting IDs or other fields from one endpoint for use in another query.

  • Uses a config file to avoid repetition on the command-line
  • Set URL paths, query strings, or headers
  • Pipe output from one endpoint to another
  • Ability to "explode" a JSON list into separate elements for separate processing

Installation

  1. Clone the repo & run go install
  2. Setup a small config file at ~/.jaq.json:
  3. Run commands!
go get github.com/Ericsson/jaq && go install
echo '{"domain":"jsonplaceholder.typicode.com"}' > ~/.jaq.json
jaq get /posts

Although not a requirement, jaq works really well if you are using jq as well for JSON querying/filtering.

Examples

These examples assume you are have the jq tool available since we do not try to duplicate its capabilities.

NOTE jaq consumes the $ as a special character so the commands below escape it so it is not consumed by your shell.

# Examples assume config file
echo '{"domain":"jsonplaceholder.typicode.com"}' > ~/.jaq.json

# Get objects from an endpoint
jaq get /posts

# Delete all the objects by id which have userId == 3
jaq get /posts | jq -c '.[] | select(.userId == 3)' | jaq delete /posts/\${1.id}

# Get comments from the 3 most recent posts
jaq get /posts | jq -c .[-3:] | jaq get /comments -q postId=\${1.id}

Configuration

jaq uses a configuration file (defaults to ~/.jaq.json but configurable via a flag) to make your commands more succinct.

You can also override most settings in the configuration file by using environment variables with similar keys. Use env vars of the form: JAQ_<KEY_NAME> to set the value of "key-name". (Env vars must be upper cased, prefixed with JAQ_ and hyphens replaced with underscores.

Auth

The auth setting can switch which authorization scheme to use by default. Currently the supported types are:

  • basic - Will use the "user" and "pass" fields to set the Authorization header.
  • token - Will set the header "Authorization: Bearer <token>"

dry-run

The dry-run setting allows you to try out potentially destructive commands and ensure all the input transformations result in the expected commands.

When running in dry-run mode, all of the input transformations occur but the resulting commands are just printed to stdout rather than actually being run.

Printing headers

Since jaq operates by piping JSON over stdin, if you want to use a header field you must include it in the JSON from the response. To facilitate this, when --print-headers is set, all of the headers are added as new JSON fields on all the JSON objects of the response with the prefix jaq-.

Error handling

You may want different behavior when encountering an error (HTTP response >= 400). Options are:

  • silence - Completely ignore those responses and do not print them or error.
  • fatal - Print them to stderr and return an error.
  • continue - Print the responses to stdout as if they were not errors and continue.
  • report - Print the responses to stderr so they do not pollute stdout for other piped commands.

Trace/Debug

When executing commands you may want an entire dump of the HTTP request/response. By specifying --trace the request/response will be dumped to stderr (so that it doesn't interfere with the JSON on stdout). By default, the body of the requests are NOT dumped. You can set --DEBUG to also add the body of the request.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].