# iOS code generation CLI - httpMethod GET expecting a query parameter when API does not support it

**URL:** <https://community.apollographql.com/t/ios-code-generation-cli-httpmethod-get-expecting-a-query-parameter-when-api-does-not-support-it/7288>\
**Category:** Client SDKs\
**Tags:** ios\
**Created:** [March 12, 2024, 12:26am UTC](https://community.apollographql.com/t/ios-code-generation-cli-httpmethod-get-expecting-a-query-parameter-when-api-does-not-support-it/7288 "2024-03-12T00:26:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike\_loo\_rea](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/mike_loo_rea/32/4949_2.png) [@mike\_loo\_rea](https://community.apollographql.com/u/mike_loo_rea)\
**Post date:** [March 12, 2024, 12:26am UTC](https://community.apollographql.com/t/ios-code-generation-cli-httpmethod-get-expecting-a-query-parameter-when-api-does-not-support-it/7288/1 "2024-03-12T00:26:04Z")

</div>

Hi there, I am using Cocoapods to import the Apollo iOS client into my native iOS project.

I am using the following schema but getting a 400 when hitting my endpoint:

```auto
{
  "schemaNamespace" : "<name >",
  "schemaDownload": {
    "downloadMethod": {
        "introspection": {
            "endpointURL": "some.url/graphql",
            "httpMethod": {
                "GET": {}
            },
            "includeDeprecatedInputValues": false,
            "outputFormat": "JSON"
        }
    },
    "downloadTimeout": 60,
    "headers": {
      "Allow-Introspection": true
    },
    "outputPath": "./graphql/"
  },
  "input" : {
    "operationSearchPaths" : [
      "**/*.graphql"
    ],
    "schemaSearchPaths" : [
      "**/schema.json"
    ]
  },
  "output" : {
    "testMocks" : {
      "none" : {
      }
    },
    "schemaTypes" : {
      "path" : "./GeneratedFiles",
      "moduleType" : {
        "other" : {}
      }
    },
    "operations" : {
      "inSchemaModule" : {
      }
    }
  },
  "options": {
    "cocoapodsCompatibleImportStatements": true
  }
}

```

Based on my observation, the endpoint I am hitting is expecting a `GET` method to introspect, however it seems the `./Pods/Apollo/apollo-ios-cli` is expecting a `queryParameterName` as per error:

```auto
Error: keyNotFound(
  GETCodingKeys(stringValue: "queryParameterName", intValue: nil),
  Swift.DecodingError.Context(
    codingPath: [
      CodingKeys(stringValue: "schemaDownload", intValue: nil),
      CodingKeys(stringValue: "downloadMethod", intValue: nil),
      CodingKeys(stringValue: "introspection", intValue: nil),
      IntrospectionCodingKeys(stringValue: "httpMethod", intValue: nil),
      CodingKeys(stringValue: "GET", intValue: nil)
    ],
    debugDescription: "No value associated with key GETCodingKeys(stringValue: \"queryParameterName\", intValue: nil) (\"queryParameterName\").",
    underlyingError: nil
  )
)

```

If I do pass a parameter like `"GET": { "queryParameterName": "foo" }`, I get the following: `Error: Received bad response from server (code 404): Optional("")`

Speaking to my backend team, it seems that usually you’d get a 400 if a header is missing to allow introspection: `Allow-Introspection`, but as you can see in my config above I am passing that value in

Is this expected?

---

<div class="post-metadata">

**Author:** ![calvincestari](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/calvincestari/32/339_2.png) [@calvincestari](https://community.apollographql.com/u/calvincestari)\
**Post date:** [March 12, 2024, 1:17am UTC](https://community.apollographql.com/t/ios-code-generation-cli-httpmethod-get-expecting-a-query-parameter-when-api-does-not-support-it/7288/2 "2024-03-12T01:17:32Z")

</div>

Hi @mike_loo_rea - I can’t say I’ve used GET to fetch a schema but from the documentation and code the query parameter is meant to contain the query name to be executed.

I believe HTTPMethod is shared with a regular GET request for general GraphQL requests but I wonder if it shouldn’t be for introspection thouugh? 🤔 Do you have a working curl statement that you can download the schema with?

---

<div class="post-metadata">

**Author:** ![mike\_loo\_rea](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/mike_loo_rea/32/4949_2.png) [@mike\_loo\_rea](https://community.apollographql.com/u/mike_loo_rea)\
**Post date:** [March 12, 2024, 2:40am UTC](https://community.apollographql.com/t/ios-code-generation-cli-httpmethod-get-expecting-a-query-parameter-when-api-does-not-support-it/7288/3 "2024-03-12T02:40:44Z")

</div>

Hi @calvincestari , thanks for the prompt reply. After further investigation it seems that the POST requests works as expected from curl. When using the `IntrospectionQuery` from [here](https://gist.github.com/martinheld/9fe32b7e2c8fd932599d36e921a2a825) and this `curl` command:

`curl -i -X POST some.url/graphql -H "Allow-Introspection: true" -H "Content-Type: application/json" -d @introspection_query.json`

I get a successful response:

```auto
HTTP/2 200
date: Tue, 12 Mar 2024 02:33:12 GMT
content-type: application/json
content-length: 75524
server: nginx
vary: Accept-Encoding
x-transaction-id: <some id>
vary: Origin

```

But I still get a 400 when using the config file:

```auto
"schemaDownload": {
    "downloadMethod": {
        "introspection": {
            "endpointURL": "some.url/graphql",
            "httpMethod": {
                "POST": {}
            },
            "includeDeprecatedInputValues": false,
            "outputFormat": "JSON"
        }
    },
    "downloadTimeout": 60,
    "headers": {
      "Allow-Introspection": true
    },
    "outputPath": "./graphql/"
  }

```

It seems like the “Allow-Introspection” header that I’m passing it might not be sent with the query, is there a way to check this?

---

<div class="post-metadata">

**Author:** ![mike\_loo\_rea](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/mike_loo_rea/32/4949_2.png) [@mike\_loo\_rea](https://community.apollographql.com/u/mike_loo_rea)\
**Post date:** [March 12, 2024, 2:43am UTC](https://community.apollographql.com/t/ios-code-generation-cli-httpmethod-get-expecting-a-query-parameter-when-api-does-not-support-it/7288/4 "2024-03-12T02:43:53Z")

</div>

Actually I think I found the cause, the header is expecting a string `"true"` rather than a boolean `true` 🤦‍♂️

---

<div class="post-metadata">

**Author:** ![calvincestari](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/calvincestari/32/339_2.png) [@calvincestari](https://community.apollographql.com/u/calvincestari)\
**Post date:** [March 12, 2024, 4:33am UTC](https://community.apollographql.com/t/ios-code-generation-cli-httpmethod-get-expecting-a-query-parameter-when-api-does-not-support-it/7288/5 "2024-03-12T04:33:38Z")

</div>

Ah, good catch. Glad you managed to get it working.
