Class to handle http(s) requests, build headers, collect data, report status codes, and header responses and passes control to session object for maintaining connection information (tokens, checking for timeout, etc...)

export

### Hierarchy

- AbstractRestClient
  - RestClient

## Index

### Constructors

- constructor

### Properties

- lastByteReceived
- mBytesReceived
- mChunks
- mContentEncoding
- mContentLength
- mData
- mDecode
- mIsJson
- mLogger
- mNormalizeRequestNewlines
- mNormalizeResponseNewlines
- mReject
- mReqHeaders
- mRequest
- mRequestStream
- mResolve
- mResource
- mResponse
- mResponseStream
- mTask
- mWriteData

### Accessors

- data
- dataString
- log
- requestFailure
- requestSuccess
- response
- session

### Methods

- appendHeaders
- processError
- request
- deleteExpectBuffer
- deleteExpectFullResponse
- deleteExpectJSON
- deleteExpectString
- deleteStreamed
- extractExpectedData
- getExpectBuffer
- getExpectFullResponse
- getExpectJSON
- getExpectString
- getStreamed
- hasQueryString
- postExpectBuffer
- postExpectFullResponse
- postExpectJSON
- postExpectString
- postStreamed
- postStreamedRequestOnly
- putExpectBuffer
- putExpectFullResponse
- putExpectJSON
- putExpectString
- putStreamed
- putStreamedRequestOnly

## Constructors

### constructor

- new RestClient(mSession: AbstractSession): RestClient

- Inherited from AbstractRestClient.constructor

  - Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:222

  Creates an instance of AbstractRestClient.

  memberof

    AbstractRestClient

  #### Parameters

  - ##### mSession: AbstractSession

    representing connection to this api

  #### Returns RestClient

## Properties

### Private lastByteReceived

lastByteReceived: number = 0

Inherited from AbstractRestClient.lastByteReceived

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:222

Last byte received when response is being streamed

memberof

  AbstractRestClient

### Private mBytesReceived

mBytesReceived: number = 0

Inherited from AbstractRestClient.mBytesReceived

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:206

Bytes received from the server response so far

memberof

  AbstractRestClient

### Private mChunks

mChunks: Buffer[] = []

Inherited from AbstractRestClient.mChunks

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:55

Contains REST chucks

memberof

  AbstractRestClient

### Private mContentEncoding

mContentEncoding: ContentEncoding

Inherited from AbstractRestClient.mContentEncoding

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:114

If we get a response containing a Content-Encoding header, and it matches an encoding type that we recognize, it is saved here

memberof

  AbstractRestClient

### Private mContentLength

mContentLength: number

Inherited from AbstractRestClient.mContentLength

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:104

If we get a response containing a Content-Length header, it is saved here

memberof

  AbstractRestClient

### Private mData

mData: Buffer = Buffer.from([])

Inherited from AbstractRestClient.mData

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:63

Contains buffered data after all REST chucks are received

memberof

  AbstractRestClient

### Private mDecode

mDecode: boolean = true

Inherited from AbstractRestClient.mDecode

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:214

Whether or not to try and decode any encoded response

memberof

  AbstractRestClient

### Private mIsJson

mIsJson: boolean

Inherited from AbstractRestClient.mIsJson

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:122

Indicates if payload data is JSON to be stringified before writing

memberof

  AbstractRestClient

### Private mLogger

mLogger: Logger

Inherited from AbstractRestClient.mLogger

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:71

Instance of logger

memberof

  AbstractRestClient

### Private mNormalizeRequestNewlines

mNormalizeRequestNewlines: boolean

Inherited from AbstractRestClient.mNormalizeRequestNewlines

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:131

Indicates if request data should have its newlines normalized to /n before sending each chunk to the server

memberof

  AbstractRestClient

### Private mNormalizeResponseNewlines

mNormalizeResponseNewlines: boolean

Inherited from AbstractRestClient.mNormalizeResponseNewlines

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:140

Indicates if response data should have its newlines normalized for the current platform (\r\n for windows, otherwise \n)

memberof

  AbstractRestClient

### Private mReject

mReject: ImperativeReject

Inherited from AbstractRestClient.mReject

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:87

Reject for errors when obtaining data

memberof

  AbstractRestClient

### Private mReqHeaders

mReqHeaders: any[]

Inherited from AbstractRestClient.mReqHeaders

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:164

Save req headers

memberof

  AbstractRestClient

### Private mRequest

mRequest: HTTP_VERB

Inherited from AbstractRestClient.mRequest

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:156

Save request

memberof

  AbstractRestClient

### Private mRequestStream

mRequestStream: Readable

Inherited from AbstractRestClient.mRequestStream

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:189

stream for outgoing request data to the server

memberof

  AbstractRestClient

### Private mResolve

mResolve: RestClientResolve

Inherited from AbstractRestClient.mResolve

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:79

Resolved when all data has been obtained

memberof

  AbstractRestClient

### Private mResource

mResource: string

Inherited from AbstractRestClient.mResource

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:148

Save resource

memberof

  AbstractRestClient

### Private mResponse

mResponse: any

Inherited from AbstractRestClient.mResponse

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:95

Contain response from http(s) request

memberof

  AbstractRestClient

### Private mResponseStream

mResponseStream: Writable

Inherited from AbstractRestClient.mResponseStream

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:181

Stream for incoming response data from the server. If specified, response data will not be buffered

memberof

  AbstractRestClient

### Private mTask

mTask: ITaskWithStatus

Inherited from AbstractRestClient.mTask

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:198

Task used to display progress bars or other user feedback mechanisms Automatically updated if task is specified and streams are provided for upload/download

memberof

  AbstractRestClient

### Private mWriteData

mWriteData: any

Inherited from AbstractRestClient.mWriteData

- Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:172

Save write data

memberof

  AbstractRestClient

## Accessors

### data

- get data(): Buffer

- Inherited from AbstractRestClient.data

  - Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:1001

  Return http(s) response body as a buffer

  readonly
  memberof

    AbstractRestClient

  #### Returns Buffer

### dataString

- get dataString(): string

- Inherited from AbstractRestClient.dataString

  - Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:1011

  Return http(s) response body as a string

  readonly
  memberof

    AbstractRestClient

  #### Returns string

### log

- get log(): Logger

- Inherited from AbstractRestClient.log

  - Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:1044

  Return the logger object for ease of reference

  readonly
  memberof

    AbstractRestClient

  #### Returns Logger

### requestFailure

- get requestFailure(): boolean

- Inherited from AbstractRestClient.requestFailure

  - Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:991

  Return whether or not a REST request was successful by HTTP status code

  readonly
  memberof

    AbstractRestClient

  #### Returns boolean

### requestSuccess

- get requestSuccess(): boolean

- Inherited from AbstractRestClient.requestSuccess

  - Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:976

  Return whether or not a REST request was successful by HTTP status code

  readonly
  memberof

    AbstractRestClient

  #### Returns boolean

### response

- get response(): any

- Inherited from AbstractRestClient.response

  - Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:1024

  Return http(s) response object

  readonly
  memberof

    AbstractRestClient

  #### Returns any

### session

- get session(): Session

- Inherited from AbstractRestClient.session

  - Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:1034

  Return this session object

  readonly
  memberof

    AbstractRestClient

  #### Returns Session

## Methods

### Protected appendHeaders

- appendHeaders(headers: any[] | undefined): any[]

- Inherited from AbstractRestClient.appendHeaders

  - Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:412

  Append specific headers for all requests by overriding this implementation

  memberof

    AbstractRestClient

  #### Parameters

  - ##### headers: any[] | undefined

    list of headers

  #### Returns any[]

  - completed list of headers

### Protected processError

- processError(_error: IImperativeError): IImperativeError

- Inherited from AbstractRestClient.processError

  - Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:433

  Process and customize errors encountered in your client. This is called any time an error is thrown from a failed Rest request using this client. error before receiving any response body from the API. You can use this, for example, to set the error tag for you client or add additional details to the error message. If you return null or undefined, Imperative will use the default error generated for your failed request.

  memberof

    AbstractRestClient

  #### Parameters

  - ##### _error: IImperativeError

  #### Returns IImperativeError

  processedError - the error with the fields set the way you want them

### request

- request(options: IRestOptions): Promise<string>

- Inherited from AbstractRestClient.request

  - Defined in @zowe/imperative/src/rest/src/client/AbstractRestClient.ts:264

  Perform the actual http REST call with appropriate user input

  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    AbstractRestClient

  #### Parameters

  - ##### options: IRestOptions

  #### Returns Promise<string>

### Static deleteExpectBuffer

- deleteExpectBuffer(session: AbstractSession, resource: string, reqHeaders?: any[]): Promise<Buffer>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:170

  REST HTTP DELETE operation

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    URI for which this request should go against

  - ##### Default value reqHeaders: any[] = []

    headers to include in the REST request

  #### Returns Promise<Buffer>

  - response body content from http(s) call

### Static deleteExpectFullResponse

- deleteExpectFullResponse(session: AbstractSession, options: IOptionsFullResponse): Promise<IRestClientResponse>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:448

  REST HTTP delete operation returning full HTTP(S) Response

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### options: IOptionsFullResponse

    list of parameters

  #### Returns Promise<IRestClientResponse>

  - response content from http(s) call

### Static deleteExpectJSON

- deleteExpectJSON<T>(session: AbstractSession, resource: string, reqHeaders?: any[]): Promise<T>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:101

  Wrap post for common error handling and supporting generic JSON types

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Type parameters

  - #### T: object

    object type to return

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    the API URI that we are targeting

  - ##### Default value reqHeaders: any[] = []

    headers for the http(s) request

  #### Returns Promise<T>

  - object on promise

### Static deleteExpectString

- deleteExpectString(session: AbstractSession, resource: string, reqHeaders?: any[]): Promise<string>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:234

  REST HTTP DELETE operation

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    URI for which this request should go against

  - ##### Default value reqHeaders: any[] = []

    headers to include in the REST request

  #### Returns Promise<string>

  - response body content from http(s) call

### Static deleteStreamed

- deleteStreamed(session: AbstractSession, resource: string, reqHeaders?: any[], responseStream: Writable, normalizeResponseNewLines?: boolean, task?: ITaskWithStatus): Promise<string>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:373

  REST HTTP DELETE operation

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    URI for which this request should go against

  - ##### Default value reqHeaders: any[] = []

    headers to include in the REST request

  - ##### responseStream: Writable

    stream to which the response data will be written

  - ##### Optional normalizeResponseNewLines: boolean

    streaming only - true if you want newlines to be \r\n on windows when receiving data from the server to responseStream. Don't set this for binary responses

  - ##### Optional task: ITaskWithStatus

    task used to update the user on the progress of their request

  #### Returns Promise<string>

  - empty string - data is not buffered for streamed requests

### Static Private extractExpectedData

- extractExpectedData(client: AbstractRestClient, toReturn?: CLIENT_PROPERTY[]): IRestClientResponse

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:516

  Helper method to extract requested data from response object If list is not passed, returns entire response

  static
  memberof

    RestClient

  #### Parameters

  - ##### client: AbstractRestClient

    HTTP(S) response object

  - ##### Default value toReturn: CLIENT_PROPERTY[] = Object.values(CLIENT_PROPERTY)

    list with object properties to return

  #### Returns IRestClientResponse

  - trimmed or full response object based on the list provided

### Static getExpectBuffer

- getExpectBuffer(session: AbstractSession, resource: string, reqHeaders?: any[]): Promise<Buffer>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:117

  REST HTTP GET operation

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    URI for which this request should go against

  - ##### Default value reqHeaders: any[] = []

    headers to include in the REST request

  #### Returns Promise<Buffer>

  - response body content from http(s) call

### Static getExpectFullResponse

- getExpectFullResponse(session: AbstractSession, options: IOptionsFullResponse): Promise<IRestClientResponse>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:390

  REST HTTP GET operation returning full HTTP(S) Response

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### options: IOptionsFullResponse

    URI for which this request should go against

  #### Returns Promise<IRestClientResponse>

  - full response or filtered based on provided params

### Static getExpectJSON

- getExpectJSON<T>(session: AbstractSession, resource: string, reqHeaders?: any[]): Promise<T>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:45

  Wrap get for common error handling and supporting generic JSON types

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Type parameters

  - #### T: object

    object type to return

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    the API URI that we are targeting

  - ##### Default value reqHeaders: any[] = []

    headers for the http(s) request

  #### Returns Promise<T>

  - object on promise

### Static getExpectString

- getExpectString(session: AbstractSession, resource: string, reqHeaders?: any[]): Promise<string>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:187

  REST HTTP GET operation

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    URI for which this request should go against

  - ##### Default value reqHeaders: any[] = []

    headers to include in the REST request

  #### Returns Promise<string>

  - response body content from http(s) call

### Static getStreamed

- getStreamed(session: AbstractSession, resource: string, reqHeaders?: any[], responseStream: Writable, normalizeResponseNewLines?: boolean, task?: ITaskWithStatus): Promise<string>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:253

  REST HTTP GET operation - streaming the response to a writable stream

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    URI for which this request should go against

  - ##### Default value reqHeaders: any[] = []

    headers to include in the REST request

  - ##### responseStream: Writable

    the stream to which the response data will be written

  - ##### Optional normalizeResponseNewLines: boolean

    streaming only - true if you want newlines to be \r\n on windows when receiving data from the server to responseStream. Don't set this for binary responses

  - ##### Optional task: ITaskWithStatus

    task used to update the user on the progress of their request

  #### Returns Promise<string>

  - empty string - data is not buffered for this request

### Static hasQueryString

- hasQueryString(query: string): boolean

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:503

  Helper method to return an indicator for whether or not a URI contains a query string.

  static
  memberof

    RestClient

  #### Parameters

  - ##### query: string

    URI

  #### Returns boolean

  - true if query is contained within URI

### Static postExpectBuffer

- postExpectBuffer(session: AbstractSession, resource: string, reqHeaders?: any[], data?: any): Promise<Buffer>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:153

  REST HTTP POST operation

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    URI for which this request should go against

  - ##### Default value reqHeaders: any[] = []

    headers to include in the REST request

  - ##### Optional data: any

    payload data

  #### Returns Promise<Buffer>

  - response body content from http(s) call

### Static postExpectFullResponse

- postExpectFullResponse(session: AbstractSession, options: IOptionsFullResponse): Promise<IRestClientResponse>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:477

  REST HTTP post operation returning full HTTP(S) Response

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### options: IOptionsFullResponse

    list of parameters

  #### Returns Promise<IRestClientResponse>

  - response content from http(s) call

### Static postExpectJSON

- postExpectJSON<T>(session: AbstractSession, resource: string, reqHeaders?: any[], payload?: any): Promise<T>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:83

  Wrap post for common error handling and supporting generic JSON types

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Type parameters

  - #### T: object

    object type to return

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    the API URI that we are targeting

  - ##### Default value reqHeaders: any[] = []

    headers for the http(s) request

  - ##### Optional payload: any

    data to write on the http(s) request

  #### Returns Promise<T>

  - object on promise

### Static postExpectString

- postExpectString(session: AbstractSession, resource: string, reqHeaders?: any[], data?: any): Promise<string>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:219

  REST HTTP POST operation

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    URI for which this request should go against

  - ##### Default value reqHeaders: any[] = []

    headers to include in the REST request

  - ##### Optional data: any

    payload data

  #### Returns Promise<string>

  - response body content from http(s) call

### Static postStreamed

- postStreamed(session: AbstractSession, resource: string, reqHeaders?: any[], responseStream: Writable, requestStream: Readable, normalizeResponseNewLines?: boolean, normalizeRequestNewLines?: boolean, task?: ITaskWithStatus): Promise<string>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:328

  REST HTTP POST operation streaming both the request and the response

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    URI for which this request should go against

  - ##### Default value reqHeaders: any[] = []

    headers to include in the REST request

  - ##### responseStream: Writable

    stream to which the response data will be written

  - ##### requestStream: Readable

    stream from which payload data will be read

  - ##### Optional normalizeResponseNewLines: boolean

    streaming only - true if you want newlines to be \r\n on windows when receiving data from the server to responseStream. Don't set this for binary responses

  - ##### Optional normalizeRequestNewLines: boolean

    streaming only - true if you want \r\n to be replaced with \n when sending data to the server from requestStream. Don't set this for binary requests

  - ##### Optional task: ITaskWithStatus

    task used to update the user on the progress of their request

  #### Returns Promise<string>

  - empty string - data is not buffered for this request

### Static postStreamedRequestOnly

- postStreamedRequestOnly(session: AbstractSession, resource: string, reqHeaders?: any[], requestStream: Readable, normalizeRequestNewLines?: boolean, task?: ITaskWithStatus): Promise<string>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:351

  REST HTTP POST operation, streaming only the request and not the response

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    URI for which this request should go against

  - ##### Default value reqHeaders: any[] = []

    headers to include in the REST request

  - ##### requestStream: Readable

    stream from which payload data will be read

  - ##### Optional normalizeRequestNewLines: boolean

    streaming only - true if you want \r\n to be replaced with \n when sending data to the server from requestStream. Don't set this for binary requests

  - ##### Optional task: ITaskWithStatus

    task used to update the user on the progress of their request

  #### Returns Promise<string>

  - string of the response

### Static putExpectBuffer

- putExpectBuffer(session: AbstractSession, resource: string, reqHeaders?: any[], data: any): Promise<Buffer>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:135

  REST HTTP PUT operation

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    URI for which this request should go against

  - ##### Default value reqHeaders: any[] = []

    headers to include in the REST request

  - ##### data: any

    payload data

  #### Returns Promise<Buffer>

  - response body content from http(s) call

### Static putExpectFullResponse

- putExpectFullResponse(session: AbstractSession, options: IOptionsFullResponse): Promise<IRestClientResponse>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:419

  REST HTTP PUT operation returning full HTTP(S) Response

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### options: IOptionsFullResponse

    list of parameters

  #### Returns Promise<IRestClientResponse>

  - response content from http(s) call

### Static putExpectJSON

- putExpectJSON<T>(session: AbstractSession, resource: string, reqHeaders?: any[], payload: any): Promise<T>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:64

  Wrap put for common error handling and supporting generic JSON types

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Type parameters

  - #### T: object

    object type to return

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    the API URI that we are targeting

  - ##### Default value reqHeaders: any[] = []

    headers for the http(s) request

  - ##### payload: any

    data to write on the http(s) request

  #### Returns Promise<T>

  - object on promise

### Static putExpectString

- putExpectString(session: AbstractSession, resource: string, reqHeaders?: any[], data: any): Promise<string>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:203

  REST HTTP PUT operation

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    URI for which this request should go against

  - ##### Default value reqHeaders: any[] = []

    headers to include in the REST request

  - ##### data: any

    payload data

  #### Returns Promise<string>

  - response body content from http(s) call

### Static putStreamed

- putStreamed(session: AbstractSession, resource: string, reqHeaders?: any[], responseStream: Writable, requestStream: Readable, normalizeResponseNewLines?: boolean, normalizeRequestNewLines?: boolean, task?: ITaskWithStatus): Promise<string>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:279

  REST HTTP PUT operation with streamed response and request

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    URI for which this request should go against

  - ##### Default value reqHeaders: any[] = []

    headers to include in the REST request

  - ##### responseStream: Writable

    stream to which the response data will be written

  - ##### requestStream: Readable

    stream from which payload data will be read

  - ##### Optional normalizeResponseNewLines: boolean

    streaming only - true if you want newlines to be \r\n on windows when receiving data from the server to responseStream. Don't set this for binary responses

  - ##### Optional normalizeRequestNewLines: boolean

    streaming only - true if you want \r\n to be replaced with \n when sending data to the server from requestStream. Don't set this for binary requests

  - ##### Optional task: ITaskWithStatus

    task used to update the user on the progress of their request

  #### Returns Promise<string>

  - empty string - data is not buffered for streamed requests

### Static putStreamedRequestOnly

- putStreamedRequestOnly(session: AbstractSession, resource: string, reqHeaders?: any[], requestStream: Readable, normalizeRequestNewLines?: boolean, task?: ITaskWithStatus): Promise<string>

- - Defined in @zowe/imperative/src/rest/src/client/RestClient.ts:302

  REST HTTP PUT operation with only streamed request, buffers response data and returns it

  static
  throws

    if the request gets a status code outside of the 200 range or other connection problems occur (e.g. connection refused)

  memberof

    RestClient

  #### Parameters

  - ##### session: AbstractSession

    representing connection to this api

  - ##### resource: string

    URI for which this request should go against

  - ##### Default value reqHeaders: any[] = []

    headers to include in the REST request

  - ##### requestStream: Readable

    stream from which payload data will be read

  - ##### Optional normalizeRequestNewLines: boolean

    streaming only - true if you want \r\n to be replaced with \n when sending data to the server from requestStream. Don't set this for binary requests

  - ##### Optional task: ITaskWithStatus

    task used to update the user on the progress of their request

  #### Returns Promise<string>

  - string of the response

Generated using TypeDoc