Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New command: add urlToItem resolver to an external connection #5527

Closed
waldekmastykarz opened this issue Sep 27, 2023 · 5 comments
Closed

New command: add urlToItem resolver to an external connection #5527

waldekmastykarz opened this issue Sep 27, 2023 · 5 comments
Assignees
Labels
Milestone

Comments

@waldekmastykarz
Copy link
Member

waldekmastykarz commented Sep 27, 2023

Usage

m365 external connection urltoitemresolver add [options]

Description

Adds a URL to item resolver to an external connection

Options

Option Description
-c, --externalConnectionId <externalConnectionId> The ID of the external connection to which to add the resolver
-u, --baseUrls <baseUrls> Comma-separated list of base URLs
--urlPattern <urlPattern> Regex pattern to match URLs
-i, --itemId <itemId> Pattern that matches captured matches from the URL with the external item ID
--priority <priority> Integer that defines the resolution order

Examples

Adds a URL to item resolver to an existing connection:

m365 external connection urltoitemresolver add --connectionId "samplesolutiongallery" --baseUrls "https://adoption.microsoft.com" --urlPattern "/sample-solution-gallery/sample/(?<sampleId>[^/]+)" --itemId "{sampleId}" --priority 1

Default properties

No response

Additional Info

Uses the following endpoint: https://learn.microsoft.com/en-us/graph/api/externalconnectors-externalconnection-update?view=graph-rest-1.0&tabs=http. Requires the external connection to exist.

The body payload needs to be structured as follow:

{
  activitySettings: {
      urlToItemResolvers: [
        {
          '@odata.type': '#microsoft.graph.externalConnectors.itemIdResolver',
          urlMatchInfo: {
            baseUrls: [
              'https://adoption.microsoft.com'
            ],
            urlPattern: '/sample-solution-gallery/sample/(?<sampleId>[^/]+)'
          },
          itemId: '{sampleId}',
          priority: 1
        }
      ]
    }
}
@waldekmastykarz waldekmastykarz added new feature needs peer review Needs second pair of eyes to review the spec or PR labels Sep 27, 2023
@waldekmastykarz
Copy link
Member Author

@pnp/cli-for-microsoft-365-maintainers any feedback before we open it up?

@waldekmastykarz
Copy link
Member Author

Also, let's align the name with #5531

@martinlingstuyl
Copy link
Contributor

Looks good to me, except the example contains a plural 'urlPatterns' option...

@waldekmastykarz
Copy link
Member Author

Fixed it! Thanks for pointing out!

@waldekmastykarz waldekmastykarz added help wanted and removed needs peer review Needs second pair of eyes to review the spec or PR labels Oct 1, 2023
@martinlingstuyl
Copy link
Contributor

This subject also highlights for me that we need some extra stuff on the site. For example: on command pages we could add a horizontal carroussel with sample scripts that contain the command in question.
Also we should definitely add scenario pages, and this could be one subject where a scenario could be helpful. Something for another day, but good to keep in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants