Skip to main content

A small JSON-based command-line utility to make REST calls

Project description

restcall

A small JSON-based command-line utility to make REST calls.

Installation

restcall is distributed as a Python package and can be installed using pip.

python -m pip install restcall

Usage

Generate a template

restcall -t get-service-name.json

restcall -t post-service-name.json

Import template from curl command

restcall -u curl-command.txt get-service-name.json

The curl-command.txt file contains the curl command.

Modify the generated template

The generated template looks like this:

{
    "url": "",
    "httpMethod": "POST",
    "reqAuthType": "none",
    "reqAuthToken": "",
    "reqContentType": "",
    "reqHeaders": {},
    "reqPayload": "",
    "resFile": ""
}

Edit the template and populate the required values. Here are the parameters, their meaning and the allowed values:

  • url - the REST URL
  • httpMethod - GET, POST, PUT, PATCH, DELETE
  • reqAuthType - none, bearer, bearer_generate, basic
  • reqAuthToken
    • the actual token if the reqAuthType is bearer
    • filepath to the restcall template to generate the token if the reqAuthType is bearer_generate
    • username:password if the reqAuthType is basic
  • reqContentType - the request content type. eg. application/json
  • reqHeaders - the request headers
  • reqPayload - the request body. If binary, provide the file path.
  • resFile - the file path for storing response externally

Make the REST call

restcall get-service-name.json

It will generate the response file get-service-name-res.json.

Output equivalent curl command:

restcall -c get-service-name.json

SSL

By default SSL certificate verification is disabled.

License

This repository and the files under it are licensed under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

restcall-1.2.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

restcall-1.2.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file restcall-1.2.0.tar.gz.

File metadata

  • Download URL: restcall-1.2.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for restcall-1.2.0.tar.gz
Algorithm Hash digest
SHA256 2c9b53b4ff3baa7b4d7b71ff57fb66087eb693777777b6e218286332c2b3887d
MD5 449d6e998c3472f2ed8d8512e4673043
BLAKE2b-256 f224c002d800cd59eac38eb45592f88a217e65c07eb1e9b2c7174d4549748bdc

See more details on using hashes here.

File details

Details for the file restcall-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: restcall-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for restcall-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7dea6eace9585323f534cc42e1638ee7ee45f350ffe04f73d8b9410e364454a
MD5 0e9f9ad938229ada9a466152b61dd73b
BLAKE2b-256 8dc0fc3b6e89fa29151ebe83f9a3e95fc347b4db2f95de24cd986a474a537b62

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page