Atlas GraphQL API
이 페이지의 내용
Atlas Device SDK는 더 이상 사용되지 않습니다. 자세한 내용은 지원 중단 페이지 를 참조하세요.
GraphQL은 더 이상 사용되지 않습니다. 자세히 알아보세요.
Atlas GraphQL API는 더 이상 사용되지 않습니다. 다른 제공자로 마이그레이션하는 방법 등 자세한 내용은 Atlas App Services에서 정적 호스팅 및 GraphQL 마이그레이션을 참조하세요.
쿼리 및 돌연변이 실행
클라이언트에서 Atlas GraphQL API를 사용하여 쿼리 및 변형을 실행합니다.
사용 가능한 작업에 대해 자세히 알아보려면 다음 App Services 설명서를 참조하세요.
App Services UI의 GraphQL 섹션에서 전체 스키마를 찾아 테스트 작업으로 탐색할 수도 있습니다.
쿼리 실행
스키마를 정의할 때 생성된 쿼리 해석기를 사용하여 Atlas GraphQL API 스키마를 쿼리할 수 있습니다. 생성된 쿼리와 해당 쿼리가 허용하는 입력에 대해 자세히 알아보려면 Atlas App Services 문서에서 쿼리 해석기 를 참조하세요.
final query = """ query { plants(limit: 5) { _id name color } } """; final queryOptions = QueryOptions( document: gql(query), ); final queryRes = await client.query(queryOptions);
돌연변이 실행
스키마를 정의할 때 생성된 변형 리졸버를 사용하여 Atlas GraphQL API 스키마에 대해 변형을 실행할 수 있습니다. 생성된 변형과 변형이 허용하는 입력에 대해 자세히 알아보려면 Atlas App Services 문서에서 변형 해석기 를 참조하세요.
final mutation = """ mutation AddPlant( \$_id: ObjectId!, \$name: String!, \$color: String) { insertOnePlant(data: { _id: \$_id name: \$name color: \$color }) { _id name color } } """; final mutationOptions = MutationOptions( document: gql(mutation), variables: { '_id': ObjectId().toString(), 'name': 'lily', 'color': 'white' }); final mutationRes = await client.mutate(mutationOptions);