Issue with API for indexing with Coveo

AI-generated summary

The user pdymfarrell reports an issue with the Discourse API when indexing content with Coveo, where the request GET /c/11.json?page=11 fails with an invalid parameter error, while other page numbers work. simon suggests the issue might be due to non-numeric values or spaces in the page parameter, but pdymfarrell clarifies that the Coveo REST API connector generates the calls, limiting their ability to debug. The user shares the Coveo configuration, which uses page and per_page for pagination, indicating the problem may lie in how Coveo handles the API calls, particularly with page 11.

Hi All,
I am using the API to index the Discourse content with Coveo, there is one call that returns and error.

The following requests work:
GET https://community.myserver.com/c/11.json?per_page=30&page=10
/c/11.json?per_page=30&page=12

But “page=11” fails, regardless of the per_page value:

GET https://community.myserver.com/c/11.json?per_page=30&page=11

{
    "errors": [
        "You supplied invalid parameters to the request: page"
    ],
    "error_type": "invalid_parameters"
}

Are you sure the number 11 is being used as the value of the page parameter? The only way I’ve been able to trigger the "You supplied invalid parameters to the request: page" error is to use a non numerical parameter. Even a space will trigger the error: http://localhost:4200/c/fun/6.json?per_page=30&page= 11

I don’t believe there was a space. The individual calls are generated by the Coveo REST API connector.

The Coveo REST API connector limits what I can do with the AP as far as error checking etc.
It is a JSON configuration that Coveo uses to make the API calls.

I pasted the Coveo configuration below incase anyone familiar with Coveo has a suggestion:

===================================================================

{
  "Services": [
    {
      "Url": "https://community.forgerock.com/",
      "Paging": {
        "OffsetStart": 0,
        "PageSize": 30,
        "OffsetType": "page",
        "Parameters": {
          "Offset": "page",
          "limit": "per_page"
        }
      },
      "Endpoints": [
        {
          "Headers": {
            "api-key": "@ApiKey",
            "api-username": "system"
          },
          "Paging": {
            "OffsetStart": 0,
            "PageSize": 30,
            "OffsetType": "page",
            "Parameters": {
              "Offset": "page",
              "limit": "per_page"
            }
          },
          "Path": "/categories.json",
          "ItemPath": "category_list.categories",
          "Method": "GET",
          "ItemType": "Category",
          "Uri": "%[coveo_url]/categories/%[id]",
          "ClickableUri": "%[coveo_url]/c/%[slug]",
          "Title": "%[name]",
          "Body": "%[description_text]",
          "Metadata": {
            "id": "%[id]",
            "updatedate": "%[updated_at]",
            "createdate": "%[created_at]",
            "filetype": "Category",
            "groupname": "%[name]",
            "color": "%[color]",
            "topic_count": "%[topic_count]",
            "post_count": "%[post_count]",
            "description": "%[description_text]",
            "visible": "%[visible]",
            "read_restricted": "%[read_restricted]"
          },
          "SubItems": [
            {
              "Headers": {
                "api-key": "@ApiKey",
                "api-username": "system"
              },
              "Paging": {
                "OffsetStart": 0,
                "PageSize": 30,
                "OffsetType": "page",
                "Parameters": {
                  "Offset": "page",
                  "limit": "per_page"
                }
              },
              "Path": "/c/%[coveo_parent.id].json",
              "ItemPath": "topic_list.topics",
              "Method": "GET",
              "ItemType": "Topic",
              "Uri": "%[coveo_url]/topics/%[id]",
              "ClickableUri": "%[coveo_url]/t/%[slug]/%[id]",
              "Title": "%[title]",
              "Body": "%[excerpt]",
              "ModifiedDate": "%[last_posted_at]",
              "SubQueries": [
                {
                  "Headers": {
                    "api-key": "@ApiKey",
                    "api-username": "<username>"
                  },
                  "Path": "/t/%[topic_id].json",
                  "Method": "GET",
                  "Metadata": {
                    "coveo_poster_names": "%[post_stream.posts[*].name]"
                  }
                }
              ],
              "Metadata": {
                "filetype": "Topic",
                "archetype": "%[archetype]",
                "archived": "%[archived]",
                "bumped": "%[bumped]",
                "bumped_at": "%[bumped_at]",
                "category_id": "%[category_id]",
                "closed": "%[closed]",
                "created_at": "%[created_at]",
                "updatedate": "%[updated_at]",
                "createdate": "%[created_at]",
                "fancy_title": "%[fancy_title]",
                "group": "%[group]",
                "groupname": "%[coveo_parent.groupname]",
                "highest_post_number": "%[highest_post_number]",
                "topic_id": "%[id]",
                "image_url": "%[image_url]",
                "last_posted_at": "%[last_posted_at]",
                "like_count": "%[like_count]",
                "pinned": "%[pinned]",
                "posters": "%[posters]",
                "posts_count": "%[posts_count]",
                "primary_group_name": "%[primary_group_name]",
                "reply_count": "%[reply_count]",
                "slug": "%[slug]",
                "title": "%[title]",
                "unseen": "%[unseen]",
                "views": "%[views]",
                "visible": "%[visible]",
                "coveo_category_name": "%[coveo_parent.name]",
                "coveo_category_description": "%[coveo_parent.description]",
                "read_restricted": "%[coveo_parent.read_restricted]"
              },
              "SubItems": [
                {
                  "Headers": {
                    "api-key": "@ApiKey",
                    "api-username": "system"
                  },
                  "Paging": {
                    "OffsetStart": 0,
                    "PageSize": 30,
                    "OffsetType": "page",
                    "Parameters": {
                      "Offset": "page",
                      "limit": "per_page"
                    }
                  },
                  "Path": "/t/%[coveo_parent.topic_id].json",
                  "ItemPath": "post_stream.posts",
                  "Method": "GET",
                  "ItemType": "Post",
                  "Uri": "%[coveo_url]/posts/%[id]",
                  "ClickableUri": "%[coveo_url]/t/%[coveo_parent.slug]/%[coveo_parent.topic_id]/%[post_number]",
                  "Title": "%[name]",
                  "Body": "%[cooked]",
                  "Metadata": {
                    "filetype": "Post",
                    "ActionsSummary": "%[actions_summary]",
                    "AvatarTemplate": "%[avatar_template]",
                    "AvgTime": "%[avg_time]",
                    "CanDelete": "%[can_delete]",
                    "CanEdit": "%[can_edit]",
                    "CanRecover": "%[avg_time]",
                    "Cooked": "%[cooked]",
                    "CreatedAt": "%[created_at]",
                    "updatedate": "%[updated_at]",
                    "createdate": "%[created_at]",
                    "DeletedAt": "%[deleted_at]",
                    "DisplayUsername": "%[display_username]",
                    "group": "%[group]",
                    "groupname": "%[coveo_parent.groupname]",
                    "Hidden": "%[hidden]",
                    "HiddenReasonId": "%[hidden_reason_id]",
                    "Id": "%[id]",
                    "IncomingLinkCount": "%[incoming_link_count]",
                    "Moderator": "%[moderator]",
                    "Name": "%[name]",
                    "PostNumber": "%[post_number]",
                    "PostType": "%[post_type]",
                    "primary_group_name": "%[primary_group_name]",
                    "QuoteCount": "%[quote_count]",
                    "Read": "%[read]",
                    "Reads": "%[reads]",
                    "ReplyCount": "%[reply_count]",
                    "ReplyToPostNumber": "%[reply_to_post_number]",
                    "Score": "%[score]",
                    "Staff": "%[staff]",
                    "topic_title": "%[coveo_parent.title]",
                    "TopicId": "%[topic_id]",
                    "TopicSlug": "%[topic_slug]",
                    "TrustLevel": "%[trust_level]",
                    "UpdatedAt": "%[updated_at]",
                    "UserDeleted": "%[user_deleted]",
                    "UserId": "%[user_id]",
                    "Username": "%[username]",
                    "Yours": "%[yours]",
                    "Version": "%[version]",
                    "visible": "%[visible]",
                    "coveo_category_name": "%[coveo_parent.coveo_category_name]",
                    "coveo_topic_title": "%[coveo_parent.title]",
                    "read_restricted": "%[coveo_parent.read_restricted]"
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}