Skip to content

GraphQL mutation example returns syntax error unexpected COLON(":") #326

Description

@Vacune

I'm testing GraphQL calls, and the following example from the documentation:

`<?php
// Mutation test
$graphQL = <<<Query
mutation ($input: CustomerInput!) {
customerCreate(input: $input)
{
customer {
id
displayName
}
userErrors {
field
message
}
}
}
Query;

$variables = [
"input" => [
"firstName" => "Greg",
"lastName" => "Variables",
"email" => "gregvariables@teleworm.us"
]
]
$shopify->GraphQL->post($graphQL, null, null, $variables);
?>`

it returns the error:

PHP Fatal error: Uncaught PHPShopify\\Exception\\ApiException: message - syntax error, unexpected COLON (":"), expecting VAR_SIGN at [1, 11], locations - line - 1, column - 11 in /var/www/html/test-app/vendor/phpclassic/php-shopify/lib/ShopifyResource.php:540\nStack trace:\n#0 /var/www/html/test-app/vendor/phpclassic/php-shopify/lib/GraphQL.php(49): PHPShopify\\ShopifyResource->processResponse()\n#1 /var/www/html/test-app/installed.php(86): PHPShopify\\GraphQL->post()\n#2 {main}\n thrown in /var/www/html/test-app/vendor/phpclassic/php-shopify/lib/ShopifyResource.php on line 540, referer: https://admin.shopify.com/

Where is the problem?

Thanks for your cooperation

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions