# eden-rest

> Eden Node JS General REST Methods

Latest version **0.0.32** (published 2015-06-01) · 0 weekly downloads

## Install

```sh
npm install eden-rest
pnpm add eden-rest
yarn add eden-rest
bun add eden-rest
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.32 |
| Published | 2015-06-01 |
| First published | 2014-09-16 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Christian Blanquera |
| Maintainers | cblanquera |
| Keywords | eden, library |

## Links

- npm: https://www.npmjs.com/package/eden-rest
- Repository: https://github.com/edenjs/rest
- Issues: https://github.com/edenjs/rest/issues
- npm.io page: https://npm.io/package/eden-rest

## Dependencies (4)

- [eden-hash](https://npm.io/package/eden-hash.md) 0.0.32
- [eden-array](https://npm.io/package/eden-array.md) 0.0.32
- [eden-class](https://npm.io/package/eden-class.md) 0.0.32
- [eden-string](https://npm.io/package/eden-string.md) 0.0.32

## Recent versions

- 0.0.32 (latest) — 2015-06-01
- 0.0.31 — 2014-11-28
- 0.0.28 — 2014-11-11
- 0.0.27 — 2014-11-11
- 0.0.26 — 2014-11-07
- 0.0.25 — 2014-11-06
- 0.0.24 — 2014-11-03
- 0.0.23 — 2014-10-17
- 0.0.21 — 2014-10-13
- 0.0.20 — 2014-10-08
- 0.0.17 — 2014-10-02
- 0.0.16 — 2014-10-02
- 0.0.15 — 2014-10-01
- 0.0.14 — 2014-09-29
- 0.0.12 — 2014-09-27
- … 6 more at https://npm.io/package/eden-rest/versions

## README

#Rest

DESCRIPTION

[![Build Status](https://api.travis-ci.org/edenjs/rest.png)](https://travis-ci.org/edenjs/rest)

## General

### Installation

```
npm install eden-rest
```

### Usage

```
var rest = require('eden-rest');
```

## Methods

  * [setAuthentication](#setAuthentication)

  * [setBody](#setBody)

  * [setQueryBody](#setQueryBody)

  * [setJsonBody](#setJsonBody)

  * [setHeaders](#setHeaders)

  * [setHost](#setHost)

  * [setMethod](#setMethod)

  * [setPath](#setPath)

  * [setPort](#setPort)

  * [setUrl](#setUrl)

  * [useSSL](#useSSL)

  * [getResponse](#getResponse)

  * [getJsonResponse](#getJsonResponse)

  * [getQueryResponse](#getQueryResponse)

---

<a name="setAuthentication"></a>

### setAuthentication

```
 this setAuthentication( 'yourname@yourdomain.com','yourpassword' );
```

Sets authentication

#### Parameters

  1. 'yourname@yourdomain.com' - string (username)

  2. 'yourpassword' - string (password)

#### Returns

 this

#### Example

##### Code

```
var username = 'yourname@yourdomain.com';
var password = 'yourpassword';
rest().setAuthentication(username, password);
typeof result;
```

##### Outputs

```
'object'
```

---

<a name="setBody"></a>

### setBody

```
 this setBody( 'id=123&trim_user=false' );
```

Sets the request body

#### Parameters

  1. 'id=123&trim_user=false' - string

#### Returns

 this

#### Example

##### Code

```
rest().setBody('id=123&trim_user=false');
typeof response;
```

##### Outputs

```
'string'
```

---

<a name="setQueryBody"></a>

### setQueryBody

```
 this setQueryBody( {id: '123', trim_user: false} );
```

Sets the request body from an object to a string query

#### Parameters

  1. {id: '123', trim_user: false} - object

#### Returns

 this

#### Example

##### Code

```
rest().setQueryBody({id: '123', trim_user: false});
```

##### Outputs

```
'object'
```

---

<a name="setJsonBody"></a>

### setJsonBody

```
 this setJsonBody({id: '123', trim_user: false});
```

Sets the request body from an object to JSON

#### Parameters

  1. {id: '123', trim_user: false} - object

#### Returns

 this

#### Example

##### Code

```
rest().setJsonBody({id: '123', trim_user: false});
typeof response;
```

##### Outputs

```
'object'
```

---

<a name="setHeaders"></a>

### setHeaders

```
 this setHeaders('https://api.twitter.com/1.1/statuses/retweet/241259202004267009.json', 'http://tinyurl.com/zhy5');
```

Sets the headers hash

#### Parameters

  1. string|object

  2. mixed

#### Returns

 this

#### Example

##### Code

```
var url = 'https://api.twitter.com/1.1/statuses/retweet/241259202004267009.json';
rest().setHeaders(url , 'http://tinyurl.com/zhy5');
```

##### Outputs

```
'string'
```

---

<a name="setHost"></a>

### setHost

```
 this setHost('https://api.twitter.com/1.1/statuses/retweet/241259202004267009.json');
```

Sets the URL host

#### Parameters

  1. 'https://api.twitter.com/1.1/statuses/retweet/241259202004267009.json' - string (url)

#### Returns

 this

#### Example

##### Code

```
var url = 'https://api.twitter.com/1.1/statuses/retweet/241259202004267009.json';
var result = rest().setHost(url);
```

##### Outputs

```
'https://api.twitter.com/1.1/statuses/retweet/241259202004267009.json'
```

---

<a name="setMethod"></a>

### setMethod

```
 this setMethod('post');
```

Sets the method IE GET, POST, PUT, DELETE

#### Parameters

  1. 'post' - string

#### Returns

 this

#### Example

##### Code

```
var url = 'https://apiu.twitter.com/1.1/statuses/retweet/241259202004267009.json';
rest()
.setUrl(url)
.setMethod('post');
```

##### Outputs

```
'object'
```

---

<a name="setPath"></a>

### setPath

```
 this setPath('https://apiu.twitter.com/1.1/statuses/retweet/241259202004267009.json');
```

Sets the url path

#### Parameters

  1. 'https://apiu.twitter.com/1.1/statuses/retweet/241259202004267009.json' - string (url)

#### Returns

 this

#### Example

##### Code

```
var url = 'https://apiu.twitter.com/1.1/statuses/retweet/241259202004267009.json';
rest().setPath(url);
```

##### Outputs

```
'https://apiu.twitter.com/1.1/statuses/retweet/241259202004267009.json'
```

---

<a name="setPort"></a>

### setPort

```
 this setPort(3306);
```

Sets the port

#### Parameters

  1. 3306 - int (port number)

#### Returns

 this

#### Example

##### Code

```
var port = 3306;
rest().setPort(port);
```

##### Outputs

```
'3306'
```

---

<a name="setUrl"></a>

### setUrl

```
 this setUrl('https://api.twitter.com/1.1/statuses/retweet/241259202004267009.json');
```

Disects URL

#### Parameters

  1. 'https://api.twitter.com/1.1/statuses/retweet/241259202004267009.json' - string (url)

#### Returns

 this

#### Example

##### Code

```
var url = 'https://api.twitter.com/1.1/statuses/retweet/241259202004267009.json';
rest().setUrl(url);
```

##### Outputs

```
'https://api.twitter.com/1.1/statuses/retweet/241259202004267009.json'
```

---

<a name="useSSL"></a>

### useSSL

```
 this useSSL('https://apiu.twitter.com/1.1/statuses/retweet/241259202004267009.json');
```

Use HTTPS

#### Parameters

#### Returns

 this

#### Example

##### Code

```
var url = 'https://apiu.twitter.com/1.1/statuses/retweet/241259202004267009.json';
rest().useSSL(url);
typeof response;
```

##### Outputs

```
'string'
```

---

<a name="getResponse"></a>

### getResponse

```
 this getResponse(function, string);
```

Sends off the request

#### Parameters

  1. function(error, response) - function

  2. 'https://api.twitter.com/1.1/statuses/retweet/241259202004267009.json' - string

#### Returns

 this

#### Example

##### Code

```
var url = 'https://api.twitter.com/1.1/statuses/retweet/241259202004267009.json';
rest().setUrl(url);
rest().getResponse(function(error, response));
```

##### Outputs

```
'https://api.twitter.com/1.1/statuses/retweet/241259202004267009.json'
```

---

<a name="getJsonResponse"></a>

### getJsonResponse

```
 this getJsonResponse(Function, String);
```

Sends off the request

#### Parameters

  1. function

  2. string

#### Returns

 this

#### Example

##### Code

```
var url = 'https://apiu.twitter.com/1.1/statuses/retweet/241259202004267009.json';
rest()
.setUrl(url)
.setMethod('post')
.setBody('id=123&trim_user=false')
.getJsonResponse(function(error, response,meta))
```

##### Outputs

```
'object'
```

---

<a name="getQueryResponse"></a>

### getQueryResponse

```
 this getQueryResponse(Function, String);
```

Sends off the request

#### Parameters

  1. function

  2. string

#### Returns

 this

#### Example

##### Code

```
var url = 'https://apiu.twitter.com/1.1/statuses/retweet/241259202004267009.json';
rest()
.setUrl(url)
.setMethod('post')
.setQueryBody({id: '123', trim_user: false})
.getQueryResponse(function(error, response));
typeof response;
```

##### Outputs

```
'object'
```

---
_Source: https://npm.io/package/eden-rest · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
