Tag: php
-
shell_exec curl to GraphQL API – Bad Request
0 I’m trying play with a website’s GraphQL API (https://www.xxxlutz.hu/api/graphql) to scrape data. In Altair working fine, but I need to run in PHP with curl_impersonate to bypass Cloudflare. I tried this, and working fine: $d = ‘{"query":"query {navigation(codes: ["header_nav_root"], levelAmount:2 , levelOffset:0){data}}"}’; $curl_impersonate_exec_command = ‘/usr/local/bin/curl_chrome100 -g -L "’ . $url . ‘" -X POST…
-
Custom filters doesn’t apply for GraphQL collection query in API Platform
0 I’m using API Platform and I want to add graphQL support and keep the same behavior between my REST calls and my graphQL calls. I have some custom filters for my get collection that works fine with REST, but they are not recognized in graphQL. According to the doc, I’ve added the following so…
-
Updating a single product in shopify app using Laravel and Graph QL
0 Im using Laravel to create a Shopify app. I have a mutation to create a product in shopify which works fine… private const CREATE_PRODUCTS_MUTATION = <<<‘QUERY’ mutation populateProduct($input: ProductInput!) { productCreate(input: $input) { product { id } } } QUERY; $response = $graph->query( [ "query" => self::CREATE_PRODUCTS_MUTATION, "variables" => [ "input" => [ "title"…
-
API Platform – GraphQL Schema mapping nullable Collection
0 I’m pretty new to GraphQL, I’m building an API and a React App that connects to it. I need some help defining my GraphQL schema, I can’t find out what I’m doing wrong, but my GraphQL schema keeps bringing a mapped Collection as nullable… I’ve been following the official docs (https://api-platform.com/docs/core/graphql/) but can’t find…
-
Error on update quantity of a variant with productVariantUpdate mutation (Shopify)
0 I am trying to run this mutation to update the quantities of a product variant on shopify via graphql . (https://shopify.dev/docs/api/admin-graphql/2023-07/mutations/productvariantupdate) productVariantUpdate(input: $input) { productVariant { id sku product { id title } inventoryQuantity } userErrors { field message } } } $input = [ ‘id’ => "gid://shopify/ProductVariant/123456", ‘inventoryQuantities’ => [ "availableQuantity" => 123,…
-
lighthouse: I have problems with many-to-many connections
0 I’m trying to create a post and attach tags to it. I’m also trying to create a post and create a tag that will be associated with the post. I followed the documentation but in the end it doesn’t work. https://lighthouse-php.com/6/eloquent/nested-mutations.html#belongstomany I get an sql error when trying to create a Post and attach…
-
How can I dynamically construct a GraphQL query in PHP?
1 I’m using the following query in GraphQL: $q = " { shop { name } } "; But I want to do it dynamically in PHP in the following way: $fieldName = ‘name’; $query = [ "shop" => [ $fieldName ] ]; And later on when passing the query to GraphQL I wanna convert…
-
How to Set GraphQL Variables in PHP
1 I’m using the FXHash API to access listings with this query: query Listings($sort: ListingsSortInput) { listings(sort: $sort) { amount createdAt price issuer { name } objkt { name } } } $options = ‘{ "sort": { "createdAt": "DESC" } }’; I’d like to use the query above in PHP with the sort by createdAt…
-
How to query all the GraphQL type fields without writing a long query?
316 Assume you have a GraphQL type and it includes many fields. How to query all the fields without writing down a long query that includes the names of all the fields? For example, If I have these fields : public function fields() { return [ ‘id’ => [ ‘type’ => Type::nonNull(Type::string()), ‘description’ => ‘The…