Requires
write_shipping
access scope.
Updates a carrier service. Only the app that creates a carrier service can update it.
Arguments
The input fields used to update a carrier service.
Was this section helpful?
CarrierServiceUpdatePayload returns
The updated carrier service.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Examples
Hide code
Copy
mutation CarrierServiceUpdate($input: DeliveryCarrierServiceUpdateInput!) {
carrierServiceUpdate(input: $input) {
carrierService {
id
name
callbackUrl
active
}
userErrors {
field
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-07/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation CarrierServiceUpdate($input: DeliveryCarrierServiceUpdateInput!) { carrierServiceUpdate(input: $input) { carrierService { id name callbackUrl active } userErrors { field message } } }",
"variables": {
"input": {
"id": "gid://shopify/DeliveryCarrierService/1036895102",
"name": "new test carrier service",
"callbackUrl": "https://new.example.com/",
"active": true
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation CarrierServiceUpdate($input: DeliveryCarrierServiceUpdateInput!) {
carrierServiceUpdate(input: $input) {
carrierService {
id
name
callbackUrl
active
}
userErrors {
field
message
}
}
}`,
{
variables: {
"input": {
"id": "gid://shopify/DeliveryCarrierService/1036895102",
"name": "new test carrier service",
"callbackUrl": "https://new.example.com/",
"active": true
}
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
mutation CarrierServiceUpdate($input: DeliveryCarrierServiceUpdateInput!) {
carrierServiceUpdate(input: $input) {
carrierService {
id
name
callbackUrl
active
}
userErrors {
field
message
}
}
}
QUERY
variables = {
"input": {
"id": "gid://shopify/DeliveryCarrierService/1036895102",
"name": "new test carrier service",
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation CarrierServiceUpdate($input: DeliveryCarrierServiceUpdateInput!) {
carrierServiceUpdate(input: $input) {
carrierService {
id
name
callbackUrl
active
}
userErrors {
field
message
}
}
}`,
"variables": {
"input": {
"id": "gid://shopify/DeliveryCarrierService/1036895102",
"name": "new test carrier service",
"callbackUrl": "https://new.example.com/",
"active": true
}
},
},
use Shopify\Clients\Graphql;
$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
mutation CarrierServiceUpdate($input: DeliveryCarrierServiceUpdateInput!) {
carrierServiceUpdate(input: $input) {
carrierService {
id
name
callbackUrl
active
}
userErrors {
field
message
}
}
}
QUERY;
$variables = [
"input" => [
"id" => "gid://shopify/DeliveryCarrierService/1036895102",
"name" => "new test carrier service",
"callbackUrl" => "https://new.example.com/",
"active" => true,
],
];
$response = $client->query(["query" => $query, "variables" => $variables]);
Hide code
Input variables
Copy
{
"input": {
"id": "gid://shopify/DeliveryCarrierService/1036895102",
"name": "new test carrier service",
"callbackUrl": "https://new.example.com/",
"active": true
}
}
Hide code
Response
JSON
{
"carrierServiceUpdate": {
"carrierService": {
"id": "gid://shopify/DeliveryCarrierService/1036895102",
"name": "new test carrier service",
"callbackUrl": "https://new.example.com/",
"active": true
},
"userErrors": []
}
}