UiPath Documentation
functions
latest
false
Functions user guide
  • Overview
    • About Functions
  • Python functions
  • Deploy and run

Call an Integration Service activity

Call a connector operation from a Python function with invoke_activity, and resolve the object path behind a Studio activity name using the UiPath CLI.

Studio activity names such as Get Email By ID are labels on a connector object and operation. Python has no equivalent lookup by activity name, so a function calls the underlying operation directly through connections.invoke_activity, describing the request with ActivityMetadata.

Prerequisites

  • An Integration Service connection for the connector, declared as a binding. See Declare a resource binding.
  • An authenticated UiPath CLI (uip) session.
Note:

sdk.connections.retrieve() returns connection metadata only, such as the id, base URI, and folder. It does not call the connector. invoke_activity calls retrieve internally, so both are not needed.

Resolve the object path for an activity

  1. List the connector's activities and the object each one maps to:

    uip is activities list uipath-microsoft-outlook365 --output table
    uip is activities list uipath-microsoft-outlook365 --output table
    
  2. Describe the object to get the concrete path for each of its operations:

    uip is resources describe uipath-microsoft-outlook365 Message \
        --connection-id <connection-id>
    uip is resources describe uipath-microsoft-outlook365 Message \
        --connection-id <connection-id>
    

Result

The two commands resolve an activity name to a path. For Get Email By ID:

Activity nameObjectOperationPath
Get Email By IDMessageGETBYID/hubs/productivity/messages/{id}
Get Email ListMessageGET/messages

The same two commands work for any connector, so this is the general recipe for turning an activity name into an ActivityMetadata definition.

Important:

GETBYID is the connector's operation kind, not an HTTP verb. Pass method_name="GET" to ActivityMetadata.

Call the operation from your function

  1. Import ActivityMetadata and ActivityParameterLocationInfo:

    from uipath.platform import UiPath
    from uipath.platform.connections.connections import (
        ActivityMetadata,
        ActivityParameterLocationInfo,
    )
    from uipath.platform import UiPath
    from uipath.platform.connections.connections import (
        ActivityMetadata,
        ActivityParameterLocationInfo,
    )
    
  2. Describe the request and route each input to its location:

    sdk = UiPath()
    
    payload = sdk.connections.invoke_activity(
        activity_metadata=ActivityMetadata(
            object_path="/hubs/productivity/messages/{id}",
            method_name="GET",
            content_type="application/json",
            parameter_location_info=ActivityParameterLocationInfo(
                path_params=["id"],
            ),
        ),
        connection_id=OUTLOOK_CONNECTION_KEY,
        activity_input={"id": message_id},
    )
    sdk = UiPath()
    
    payload = sdk.connections.invoke_activity(
        activity_metadata=ActivityMetadata(
            object_path="/hubs/productivity/messages/{id}",
            method_name="GET",
            content_type="application/json",
            parameter_location_info=ActivityParameterLocationInfo(
                path_params=["id"],
            ),
        ),
        connection_id=OUTLOOK_CONNECTION_KEY,
        activity_input={"id": message_id},
    )
    
  3. Map the connector response onto your Output model.

Result

The SDK substitutes id into the path and issues the request:

GET /elements_/v3/element/instances/{connectionId}/hubs/productivity/messages/{id}
GET /elements_/v3/element/instances/{connectionId}/hubs/productivity/messages/{id}

The instances segment carries the connection id, not the elementInstanceId from the connection metadata.

Routing inputs with parameter_location_info

Each field of ActivityParameterLocationInfo names the keys of activity_input that belong in one part of the request.

FieldRoutes the input to
path_paramsPlaceholders in object_path, such as {id}
query_paramsThe query string
header_paramsRequest headers
body_fieldsThe request body
multipart_paramsMultipart form fields
Warning:

An input that is not listed in parameter_location_info is dropped without an error. A misspelled key surfaces as a missing parameter in the connector response, not as a failed call.

Connector responses vary by version. The same record can arrive as a bare object, wrapped in a list, or inside an items envelope, and field names can follow either the provider's shape or a flattened connector shape. Read the fields you need defensively rather than assuming one shape.

Next steps

Was this page helpful?

Connect

Need help? Support

Want to learn? UiPath Academy

Have questions? UiPath Forum

Stay updated