{"id":24472930,"url":"https://github.com/shutterstock/armrest","last_synced_at":"2025-07-17T04:39:49.110Z","repository":{"id":6201551,"uuid":"7432357","full_name":"shutterstock/armrest","owner":"shutterstock","description":"A high-level HTTP / REST client for Node","archived":false,"fork":false,"pushed_at":"2020-10-02T20:16:54.000Z","size":400,"stargazers_count":29,"open_issues_count":3,"forks_count":16,"subscribers_count":36,"default_branch":"master","last_synced_at":"2025-03-27T02:51:21.610Z","etag":null,"topics":["http","node","nodejs","rest"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shutterstock.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-03T23:43:08.000Z","updated_at":"2021-02-02T08:08:29.000Z","dependencies_parsed_at":"2022-09-10T19:22:46.473Z","dependency_job_id":null,"html_url":"https://github.com/shutterstock/armrest","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shutterstock%2Farmrest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shutterstock%2Farmrest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shutterstock%2Farmrest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shutterstock%2Farmrest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shutterstock","download_url":"https://codeload.github.com/shutterstock/armrest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248395996,"owners_count":21096856,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http","node","nodejs","rest"],"created_at":"2025-01-21T08:14:09.351Z","updated_at":"2025-04-13T11:45:51.517Z","avatar_url":"https://github.com/shutterstock.png","language":"JavaScript","readme":"# Armrest\n\n[![Build Status](https://travis-ci.org/shutterstock/armrest.svg?branch=master)](https://travis-ci.org/shutterstock/armrest)\n\n\u003e A high-level HTTP / REST services client for Node.\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n\t- [Example](#example)\n\t- [Instantiating a REST Client](#instantiating-a-rest-client)\n\t- [Methods](#methods)\n\t- [Working with Many Backend Services](#working-with-many-backend-services)\n\t- [Working with Many Client Instances](#working-with-many-client-instances)\n- [Authors](#authors)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\nInstall with npm:\n\n```sh\n$ npm install armrest\n```\n\n## Usage\n\n### Example\n\nSet up a client and issue a GET request:\n\n```javascript\nvar armrest = require('armrest');\nvar github = armrest.client('https://api.github.com');\n\ngithub.get({\n\turl: '/orgs/:organization',\n\tparams: { organization: 'shutterstock' },\n\tsuccess: function(organization) {\n\t\t// do something\n\t}\n});\n```\n\n### Instantiating a REST Client\n\nThe `armrest.client()` factory takes two forms: send the base URL as a string if that will get you going, or send an object with parameters below for more flexibility.\n\n##### base\n\nThe base URL, including any or all of the scheme, hostname, port, and path.  This option overrides `scheme`, `hostname` and `port`.\n\n##### protocol\n\nThe scheme part of the base URL if `base` is not specified, either `http` or `https`.  Defaults to `http`.  Aliased as `scheme` as well for compatibility.\n\n##### host\n\nThe host part of the base URL (`hostname`:`port`) if `base` is not specified.\n\n##### hostname\n\nThe hostname part of the base URL if `base` is not specified.\n\n##### port\n\nThe port part of the base URL if `base` is not specified.\n\n##### timeout\n\nNumber of milliseconds to wait first for establishing the socket connection and sending the request, and then again for receiving the response.\n\n##### serializer\n\nOptional parameter, an object specifying a `contentType`, and functions to `serialize` and `deserialize` request and response bodies.\n\n##### logger\n\nInstance of some logger that implements `debug()`, `info()`, `warn()`, and `error()`.\n\n##### logLevel\n\nString indicating criticality of messages to log; one of `debug`, `info`, `warn`, or `error`.\n\n### Methods\n\n#### get(), post(), put(), patch(), delete(), head()\n\nMake an HTTP request to the service, given the parameters below.\n\n##### url\n\nThe path component of the URL.  URLs may have sinatra-style interpolation tokens to be filled in by values from params.\n\n##### params\n\nParamaters to be sent with the request.  For HEAD, GET and DELETE requests these will be sent as query string parameters.  For other HTTP methods, parameters will be serialized according to the serialization scheme associated with the client, and sent in the body of the request.\n\n##### success\n\nCallback to be executed upon success, with the deserialized response as the first parameter, followed by the full response object.\n\n##### error\n\nCallback to be executed upon failure, with the error as the first parameter, followed by the full response object.\n\n##### complete\n\nCallback to be executed upon completion, whether the request failed or succeeded, with the error as the first parameter, followed by the full response object, and finally the deserialized response.\n\n###### Additional parameters are passed through to [request](https://github.com/mikeal/request#requestoptions-callback).\n\n### Working with Many Backend Services\n\nWhen you're working with a number of services at once, use the following alternate interface to configure clients and get easy access for later use.\n\n#### configure(name, options)\n\nA class method to register backend services.  Send a name for the service, and options expected by the constructor, as detailed above.\n\n```javascript\nvar armrest = require('armrest');\n\narmrest.configure('github', {\n\tbase: 'http://api.github.com',\n\ttimeout: 5000\n});\n\narmrest.configure('metacpan', {\n\tbase: 'http://api.metacpan.org',\n\ttimeout: 5000\n});\n\n```\n\nLater from elsewhere, load in the module and interact with services by name.\n\n```javascript\nvar armrest = require('armrest');\n\narmrest.github.get(...);\narmrest.metacpan.get(...);\n```\n\n### Working with Many Client Instances\n\nWhen you're working with a number of client instances and you want them to have the same default behavior, use the following method.\n\n#### setDefaults(options)\n\n```javascript\nvar armrest = require('armrest');\n\narmrest.setDefaults({\n\ttimeout: 10000\n});\n```\n\nThis will set the default timeout for any request to 10000 milliseconds.  To clear the default behaviors, use:\n\n```javascript\narmrest.clearDefaults();\n```\n\n## Authors\n\nThis library was developed by David Chester and Zubin Tiku at [Shutterstock](http://www.shutterstock.com)\n\n## Contribute\n\nPlease do! Check out our [contributing guide](CONTRIBUTING.md).\n\n## License\n\n[MIT](LICENSE) © 2012-2017 Shutterstock Images, LLC\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshutterstock%2Farmrest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshutterstock%2Farmrest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshutterstock%2Farmrest/lists"}