# ResourceUrlsCallbackContext Methods

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [ResourceUrlsCallbackContext](/reference/api/csharp/aspire.hosting/resourceurlscallbackcontext.md)
- Kind: `Methods`
- Members: `2`

Represents a callback context for resource URLs.

## GetEndpoint(string)

- Name: `GetEndpoint(string)`
- Modifiers: `nullable`
- Returns: [EndpointReference?](/reference/api/csharp/aspire.hosting/endpointreference.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/ResourceUrlsCallbackContext.cs#L32-L36)

Gets an endpoint reference from [ResourceUrlsCallbackContext.Resource](/reference/api/csharp/aspire.hosting/resourceurlscallbackcontext/properties.md#resource) for the specified endpoint name. If [ResourceUrlsCallbackContext.Resource](/reference/api/csharp/aspire.hosting/resourceurlscallbackcontext/properties.md#resource) does not implement [IResourceWithEndpoints](/reference/api/csharp/aspire.hosting/iresourcewithendpoints.md) then returns `null`.

```csharp
public class ResourceUrlsCallbackContext
{
    public EndpointReference? GetEndpoint(
        string name)
    {
        // ...
    }
}
```

## Parameters

- `name` (`string`)
  The name of the endpoint.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## GetEndpoint(string, NetworkIdentifier)

- Name: `GetEndpoint(string, NetworkIdentifier)`
- Modifiers: `nullable`
- Returns: [EndpointReference?](/reference/api/csharp/aspire.hosting/endpointreference.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/ResourceUrlsCallbackContext.cs#L45-L49)

Gets an endpoint reference from [ResourceUrlsCallbackContext.Resource](/reference/api/csharp/aspire.hosting/resourceurlscallbackcontext/properties.md#resource) for the specified endpoint name. If [ResourceUrlsCallbackContext.Resource](/reference/api/csharp/aspire.hosting/resourceurlscallbackcontext/properties.md#resource) does not implement [IResourceWithEndpoints](/reference/api/csharp/aspire.hosting/iresourcewithendpoints.md) then returns `null`.

```csharp
public class ResourceUrlsCallbackContext
{
    public EndpointReference? GetEndpoint(
        string name,
        NetworkIdentifier contextNetworkID)
    {
        // ...
    }
}
```

## Parameters

- `name` (`string`)
  The name of the endpoint.
- `contextNetworkID` ([NetworkIdentifier](/reference/api/csharp/aspire.hosting/networkidentifier.md))
  The identifier of the network that serves as the context for the endpoint reference.
