AppSyncClient

AppSync provides API actions for creating and interacting with data sources using GraphQL from your application.

Installation

NPM
npm install @aws-sdk/client-appsync
Yarn
yarn add @aws-sdk/client-appsync
pnpm
pnpm add @aws-sdk/client-appsync

AppSyncClient Operations

Command
Summary
AssociateApiCommand

Maps an endpoint to your custom domain.

AssociateMergedGraphqlApiCommand

Creates an association between a Merged API and source API using the source API's identifier.

AssociateSourceGraphqlApiCommand

Creates an association between a Merged API and source API using the Merged API's identifier.

CreateApiCacheCommand

Creates a cache for the GraphQL API.

CreateApiCommand

Creates an Api object. Use this operation to create an AppSync API with your preferred configuration, such as an Event API that provides real-time message publishing and message subscriptions over WebSockets.

CreateApiKeyCommand

Creates a unique key that you can distribute to clients who invoke your API.

CreateChannelNamespaceCommand

Creates a ChannelNamespace for an Api.

CreateDataSourceCommand

Creates a DataSource object.

CreateDomainNameCommand

Creates a custom DomainName object.

CreateFunctionCommand

Creates a Function object.

A function is a reusable entity. You can use multiple functions to compose the resolver logic.

CreateGraphqlApiCommand

Creates a GraphqlApi object.

CreateResolverCommand

Creates a Resolver object.

A resolver converts incoming requests into a format that a data source can understand, and converts the data source's responses into GraphQL.

CreateTypeCommand

Creates a Type object.

DeleteApiCacheCommand

Deletes an ApiCache object.

DeleteApiCommand

Deletes an Api object

DeleteApiKeyCommand

Deletes an API key.

DeleteChannelNamespaceCommand

Deletes a ChannelNamespace.

DeleteDataSourceCommand

Deletes a DataSource object.

DeleteDomainNameCommand

Deletes a custom DomainName object.

DeleteFunctionCommand

Deletes a Function.

DeleteGraphqlApiCommand

Deletes a GraphqlApi object.

DeleteResolverCommand

Deletes a Resolver object.

DeleteTypeCommand

Deletes a Type object.

DisassociateApiCommand

Removes an ApiAssociation object from a custom domain.

DisassociateMergedGraphqlApiCommand

Deletes an association between a Merged API and source API using the source API's identifier and the association ID.

DisassociateSourceGraphqlApiCommand

Deletes an association between a Merged API and source API using the Merged API's identifier and the association ID.

EvaluateCodeCommand

Evaluates the given code and returns the response. The code definition requirements depend on the specified runtime. For APPSYNC_JS runtimes, the code defines the request and response functions. The request function takes the incoming request after a GraphQL operation is parsed and converts it into a request configuration for the selected data source operation. The response function interprets responses from the data source and maps it to the shape of the GraphQL field output type.

EvaluateMappingTemplateCommand

Evaluates a given template and returns the response. The mapping template can be a request or response template.

Request templates take the incoming request after a GraphQL operation is parsed and convert it into a request configuration for the selected data source operation. Response templates interpret responses from the data source and map it to the shape of the GraphQL field output type.

Mapping templates are written in the Apache Velocity Template Language (VTL).

FlushApiCacheCommand

Flushes an ApiCache object.

GetApiAssociationCommand

Retrieves an ApiAssociation object.

GetApiCacheCommand

Retrieves an ApiCache object.

GetApiCommand

Retrieves an Api object.

GetChannelNamespaceCommand

Retrieves the channel namespace for a specified Api.

GetDataSourceCommand

Retrieves a DataSource object.

GetDataSourceIntrospectionCommand

Retrieves the record of an existing introspection. If the retrieval is successful, the result of the instrospection will also be returned. If the retrieval fails the operation, an error message will be returned instead.

GetDomainNameCommand

Retrieves a custom DomainName object.

GetFunctionCommand

Get a Function.

GetGraphqlApiCommand

Retrieves a GraphqlApi object.

GetGraphqlApiEnvironmentVariablesCommand

Retrieves the list of environmental variable key-value pairs associated with an API by its ID value.

GetIntrospectionSchemaCommand

Retrieves the introspection schema for a GraphQL API.

GetResolverCommand

Retrieves a Resolver object.

GetSchemaCreationStatusCommand

Retrieves the current status of a schema creation operation.

GetSourceApiAssociationCommand

Retrieves a SourceApiAssociation object.

GetTypeCommand

Retrieves a Type object.

ListApiKeysCommand

Lists the API keys for a given API.

API keys are deleted automatically 60 days after they expire. However, they may still be included in the response until they have actually been deleted. You can safely call DeleteApiKey to manually delete a key before it's automatically deleted.

ListApisCommand

Lists the APIs in your AppSync account.

ListApis returns only the high level API details. For more detailed information about an API, use GetApi.

ListChannelNamespacesCommand

Lists the channel namespaces for a specified Api.

ListChannelNamespaces returns only high level details for the channel namespace. To retrieve code handlers, use GetChannelNamespace.

ListDataSourcesCommand

Lists the data sources for a given API.

ListDomainNamesCommand

Lists multiple custom domain names.

ListFunctionsCommand

List multiple functions.

ListGraphqlApisCommand

Lists your GraphQL APIs.

ListResolversByFunctionCommand

List the resolvers that are associated with a specific function.

ListResolversCommand

Lists the resolvers for a given API and type.

ListSourceApiAssociationsCommand

Lists the SourceApiAssociationSummary data.

ListTagsForResourceCommand

Lists the tags for a resource.

ListTypesByAssociationCommand

Lists Type objects by the source API association ID.

ListTypesCommand

Lists the types for a given API.

PutGraphqlApiEnvironmentVariablesCommand

Creates a list of environmental variables in an API by its ID value.

When creating an environmental variable, it must follow the constraints below:

  • Both JavaScript and VTL templates support environmental variables.

  • Environmental variables are not evaluated before function invocation.

  • Environmental variables only support string values.

  • Any defined value in an environmental variable is considered a string literal and not expanded.

  • Variable evaluations should ideally be performed in the function code.

When creating an environmental variable key-value pair, it must follow the additional constraints below:

  • Keys must begin with a letter.

  • Keys must be at least two characters long.

  • Keys can only contain letters, numbers, and the underscore character (_).

  • Values can be up to 512 characters long.

  • You can configure up to 50 key-value pairs in a GraphQL API.

You can create a list of environmental variables by adding it to the environmentVariables payload as a list in the format {"key1":"value1","key2":"value2", …}. Note that each call of the PutGraphqlApiEnvironmentVariables action will result in the overwriting of the existing environmental variable list of that API. This means the existing environmental variables will be lost. To avoid this, you must include all existing and new environmental variables in the list each time you call this action.

StartDataSourceIntrospectionCommand

Creates a new introspection. Returns the introspectionId of the new introspection after its creation.

StartSchemaCreationCommand

Adds a new schema to your GraphQL API.

This operation is asynchronous. Use to determine when it has completed.

StartSchemaMergeCommand

Initiates a merge operation. Returns a status that shows the result of the merge operation.

TagResourceCommand

Tags a resource with user-supplied tags.

UntagResourceCommand

Untags a resource.

UpdateApiCacheCommand

Updates the cache for the GraphQL API.

UpdateApiCommand

Updates an Api.

UpdateApiKeyCommand

Updates an API key. You can update the key as long as it's not deleted.

UpdateChannelNamespaceCommand

Updates a ChannelNamespace associated with an Api.

UpdateDataSourceCommand

Updates a DataSource object.

UpdateDomainNameCommand

Updates a custom DomainName object.

UpdateFunctionCommand

Updates a Function object.

UpdateGraphqlApiCommand

Updates a GraphqlApi object.

UpdateResolverCommand

Updates a Resolver object.

UpdateSourceApiAssociationCommand

Updates some of the configuration choices of a particular source API association.

UpdateTypeCommand

Updates a Type object.

AppSyncClient Configuration

Parameter
Type
Description
defaultsMode
Optional
DefaultsMode | Provider<DefaultsMode>
The @smithy/smithy-client#DefaultsMode that will be used to determine how certain default configuration options are resolved in the SDK.
disableHostPrefix
Optional
boolean
Disable dynamically changing the endpoint of the client based on the hostPrefix trait of an operation.
extensions
Optional
RuntimeExtension[]
Optional extensions
logger
Optional
Logger
Optional logger for logging debug/info/warn/error.
maxAttempts
Optional
number | Provider<number>
Value for how many times a request will be made at most in case of retry.
profile
Optional
string
Setting a client profile is similar to setting a value for the AWS_PROFILE environment variable. Setting a profile on a client in code only affects the single client instance, unlike AWS_PROFILE.When set, and only for environments where an AWS configuration file exists, fields configurable by this file will be retrieved from the specified profile within that file. Conflicting code configuration and environment variables will still have higher priority.For client credential resolution that involves checking the AWS configuration file, the client's profile (this value) will be used unless a different profile is set in the credential provider options.
region
Optional
string | Provider<string>
The AWS region to which this client will send requests
requestHandler
Optional
__HttpHandlerUserInput
The HTTP handler to use or its constructor options. Fetch in browser and Https in Nodejs.
retryMode
Optional
string | Provider<string>
Specifies which retry algorithm to use.
useDualstackEndpoint
Optional
boolean | Provider<boolean>
Enables IPv6/IPv4 dualstack endpoint.
useFipsEndpoint
Optional
boolean | Provider<boolean>
Enables FIPS compatible endpoints.
Additional config fields are described in the full configuration type: AppSyncClientConfig