-1

I get an error when executing a graph query using the MeshRestClient -

{
  "errors": [
    {
      "message": "Validation error of type InvalidFragmentType: Fragment cannot be spread here as objects of type Node can never be of type teaching @ 'node/children/elements'",
      "type": "ValidationError",
      "locations": [
        {
          "line": 1,
          "column": 288
        }
      ]
    },
    {
      "message": "Validation error of type FieldUndefined: Field 'fields' in type 'teaching' is undefined @ 'node/children/elements/fields'",
      "type": "ValidationError",
      "locations": [
        {
          "line": 1,
          "column": 315
        }
      ]
    }
  ]
}

Although the same request works fine in Postman.

Update: I realized the client is executing the request against the /api/v1 when using the client.
If I post the same query against /api/v1 in Postman, I can reproduce the error.

I think if I can force the rest client to use /api/v2, it should work..

Jeremy
  • 2,970
  • 1
  • 26
  • 50

1 Answers1

1

You can use /api/v2 with the MeshRestClient by setting the base path when creating the client:

MeshRestClient.create(MeshRestClientConfig.newConfig()
    .setHost("demo.getmesh.io")
    .setPort(80)
    .setSsl(true)
    .setBasePath("/api/v2")
    .build());
PGuertler
  • 243
  • 1
  • 2
  • 6
  • 1
    Thanks! I was using the simple constructor and didn't see the baseUrl option. I appreciate all the work you guys have put into Mesh. – Jeremy Nov 29 '19 at 14:24