Skip to main content

RemoteApiResponse

Class

Class in the Lens Scripting API.

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

Since Lens Scripting v164

Index

Extends

Properties

body

readonly body: string

Since

Lens Scripting Version 164


metadata

readonly metadata: object

Index Signature

[key: string]: string

Since

Lens Scripting Version 164


statusCode

readonly statusCode: number

The integer status code of the response.

The meaning of possible status code values are defined as follows:

  • 1: Success. This code corresponds to the 2XX HTTP response status codes.
  • 2: Redirected. This code corresponds to the 3XX HTTP response status codes.
  • 3: Bad request. This code corresponds to the 4XX HTTP response status codes other than 401, 403, 404, 408, 413, 414, and 431 which are mapped separately below.
  • 4: Access denied. This code corresponds to the HTTP response status codes 401 and 403.
  • 5: Not found. This code corresponds to the HTTP response status code 404. It is also returned when the API spec is not found by the remote API service.
  • 6: Timeout. This code corresponds to the HTTP response status codes 408 and 504.
  • 7: Request too large. This code corresponds to the HTTP response status codes 413, 414, and 431.
  • 8: Server error. This code corresponds to the 5XX HTTP response status codes other than 504 (timeout).
  • 9: Request cancelled by the caller.
  • 10: Internal error happened inside the remote API framework (i.e., not from the remote service being called).
  • 11: Rate limited. The request was rejected due to rate limiting.

All other values have undefined meaning and should be treated as internal error (code 10).

Since

Lens Scripting Version 164


uriResources

readonly uriResources: DynamicResource[]

Since

Lens Scripting Version 278

Methods

asResource()

asResource(): DynamicResource

Converts the response into a DynamicResource object, which can be used by RemoteMediaModule to load the media content in the response body.

Returns

DynamicResource

Since

Lens Scripting Version 179


getTypeName()

static getTypeName(): TypeName<RemoteApiResponse>

Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

Returns

TypeName<RemoteApiResponse>

Since

Lens Scripting Version 164

Overrides

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object matches or derives from the passed in type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.isOfType


isSame()

isSame(other): boolean

Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

ScriptObject.isSame