AWS Amplify API
AWS Amplify Home
Options
All

- Public
- Public/Protected
- All

Inherited Externals Only exported
Menu

HTTP Client for REST requests. Send and receive JSON data. Sign request with AWS credentials if available Usage:

    const restClient = new RestClient();
    restClient.get('...')
    .then(function(data) {
    console.log(data);
    })
    .catch(err => console.log(err));

### Hierarchy

- RestClient

## Index

### Constructors

- constructor

### Methods

- ajax
- del
- endpoint
- get
- head
- patch
- post
- put

## Constructors

### constructor

- new RestClient(options: apiOptions): RestClient

- - Defined in api/src/RestClient.ts:39

  #### Parameters

  - ##### options: apiOptions

  #### Returns RestClient

## Methods

### ajax

- ajax(url: string, method: string, init: any): Promise<any>

- - Defined in api/src/RestClient.ts:64

  Basic HTTP request. Customizable

  #### Parameters

  - ##### url: string

    Full request URL

  - ##### method: string

    Request HTTP method

  - ##### init: any

  #### Returns Promise<any>

  - A promise that resolves to an object with response status and JSON data, if successful.

### del

- del(url: string, init: any): Promise<any>

- - Defined in api/src/RestClient.ts:182

  DELETE HTTP request

  #### Parameters

  - ##### url: string

    Full request URL

  - ##### init: any

    Request extra params

  #### Returns Promise<any>

  - A promise that resolves to an object with response status and JSON data, if successful.

### endpoint

- endpoint(apiName: string): string

- - Defined in api/src/RestClient.ts:201

  Getting endpoint for API

  #### Parameters

  - ##### apiName: string

    The name of the api

  #### Returns string

  - The endpoint of the api

### get

- get(url: string, init: any): Promise<any>

- - Defined in api/src/RestClient.ts:142

  GET HTTP request

  #### Parameters

  - ##### url: string

    Full request URL

  - ##### init: any

    Request extra params

  #### Returns Promise<any>

  - A promise that resolves to an object with response status and JSON data, if successful.

### head

- head(url: string, init: any): Promise<any>

- - Defined in api/src/RestClient.ts:192

  HEAD HTTP request

  #### Parameters

  - ##### url: string

    Full request URL

  - ##### init: any

    Request extra params

  #### Returns Promise<any>

  - A promise that resolves to an object with response status and JSON data, if successful.

### patch

- patch(url: string, init: any): Promise<any>

- - Defined in api/src/RestClient.ts:162

  PATCH HTTP request

  #### Parameters

  - ##### url: string

    Full request URL

  - ##### init: any

    Request extra params

  #### Returns Promise<any>

  - A promise that resolves to an object with response status and JSON data, if successful.

### post

- post(url: string, init: any): Promise<any>

- - Defined in api/src/RestClient.ts:172

  POST HTTP request

  #### Parameters

  - ##### url: string

    Full request URL

  - ##### init: any

    Request extra params

  #### Returns Promise<any>

  - A promise that resolves to an object with response status and JSON data, if successful.

### put

- put(url: string, init: any): Promise<any>

- - Defined in api/src/RestClient.ts:152

  PUT HTTP request

  #### Parameters

  - ##### url: string

    Full request URL

  - ##### init: any

    Request extra params

  #### Returns Promise<any>

  - A promise that resolves to an object with response status and JSON data, if successful.