Gravatar for francisco.pizarro@mcplusa.com

Question by Francisco Pizarro, Jan 31, 2019 8:13 PM

Trying to use Generic Rest API for Microsoft graph

I'm trying to create a simple Generic REST API source using the Microsoft Graph API, I've already tested the endpoint and token with Postman and it works, but when I try it in Generic rest I always got this error:

GENERIC_REST_INVALID_REST_CONFIGURATION

One or more parameter values of your source configuration are invalid.
The provided JSON configuration does not contain a valid REST configuration.

This is my current JSON configuration:

{
  "Services": [
    {
      "Url": "https://graph.microsoft.com/beta/",
      "Endpoints": [
        {
          "Headers": {
            "Authorization": "Bearer @ApiKey"
          },
          "Path": "/groups?$filter=resourceProvisioningOptions/Any(x:x eq 'Team')",
          "Method": "GET",
          "ItemPath": "value",
          "ItemType": "Item",
          "Uri": "%[coveourl]/items/%[id]",
          "ClickableUri": "%[coveourl]/items/%[id]",
          "Title": "%[description]",
          "Metadata": {
            "id": "%[id]"
          }
        }
      ]
    }
  ]
}

Any help is greatly appreciated. Thanks.

1 Reply
Gravatar for flguillemette@coveo.com

Answer by François Lachance-Guillemette, Feb 1, 2019 3:14 PM

In the Generic REST API Source Reference, it looks like the actual path does *not* take query parameters and must only contain the URL.

Have you tried using this `QueryParameters` property instead?

I have not tested it, but I think your `endpoint` needs to look like the following:

{
    "Headers": {
        "Authorization": "Bearer @ApiKey"
    },
    "Path": "/groups",
    "QueryParameters": {
        "$filter": "resourceProvisioningOptions/Any(x:x eq 'Team')"
    },
    "Method": "GET",
    "ItemPath": "value",
    "ItemType": "Item",
    "Uri": "%[coveo_url]/items/%[id]",
    "ClickableUri": "%[coveo_url]/items/%[id]",
    "Title": "%[description]",
    "Metadata": {
        "id": "%[id]"
    }
}

The same syntax can be seen here in the examples

Gravatar for francisco.pizarro@mcplusa.com

Comment by Francisco Pizarro, Feb 1, 2019 3:23 PM

I tried but it still not working (I'm having the same error code: GENERIC_REST_INVALID_REST_CONFIGURATION)

I've also tried to escape the param value, but no luck:

resourceProvisioningOptions%2FAny(x%3Ax%20eq%20'Team')
Ask a question