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.3.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

restcall-1.3.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for restcall-1.3.0.tar.gz
Algorithm Hash digest
SHA256 2690261c21cd9c1a17666b3c7409b96d5a7a64629a40aadc3e741ea135a87a52
MD5 584b59c74ff9b8a522eb4db031af7d39
BLAKE2b-256 3b6326cf38c903f4ad3392ce02a1f0d02c40a77f831a5f552826ca08956305cf

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for restcall-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 507f2dae7c2e5ae2ffba12c8a641d3fd14c19c818cda190363491127370d715d
MD5 110331c677c61c826d906487505d0c34
BLAKE2b-256 4239088241484009f7ba3762f652821da70af4624a6d235c976d0207ebdfa75a

See more details on using hashes here.

Supported by

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