Create a custom resolver
Create a new custom resolver.
Path parameters
-
An Atlas Project/Group ID.
-
The ObjectID of your application. The App Services API Project and Application IDs section demonstrates how to find this value.
Body
Required
A valid custom resolver configuration object.
-
The name of the resolver's parent type. This can be
"Query"
,"Mutation"
, or the name of a generated type if this is a computed property. -
The name of the custom resolver field that appears in the GraphQL schema.
-
The kind of input type the custom resolver uses. This value must agree with the value of
input_type
:- A scalar input type must use
"scalar"
or"scalar-list"
- A generated input type must use
"generated"
or"generated-list"
- A custom input type must use
"custom"
If undefined, the resolver does not accept an input.
Values are
scalar
,scalar-list
,generated
,generated-list
, orcustom
. - A scalar input type must use
-
The kind of payload type the custom resolver uses. This value must agree with the value of
payload_type
:- A scalar payload type must use
"scalar"
or"scalar-list"
- A generated payload type must use
"generated"
or"generated-list"
- A custom payload type must use
"custom"
If undefined, the resolver returns a
DefaultPayload
object.Values are
scalar
,scalar-list
,generated
,generated-list
, orcustom
. - A scalar payload type must use
-
The custom resolver's unique ID.
-
The resolver function's unique ID.
curl \
--request POST 'https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/graphql/custom_resolvers' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"on_type":"string","field_name":"string","input_type":"string","input_type_format":"scalar","payload_type":"string","payload_type_format":"scalar","_id":"string","function_id":"string"}'
{
"on_type": "string",
"field_name": "string",
"input_type": "string",
"input_type_format": "scalar",
"payload_type": "string",
"payload_type_format": "scalar",
"_id": "string",
"function_id": "string"
}
{
"on_type": "string",
"field_name": "string",
"input_type": "string",
"input_type_format": "scalar",
"payload_type": "string",
"payload_type_format": "scalar",
"_id": "string",
"function_id": "string"
}