# Workflow Executions API . projects . locations . workflows

## Instance Methods

Returns the executions Resource.

Close httplib2 connections.

Triggers a new execution using the latest revision of the given workflow by a Pub/Sub push notification.

### Method Details

`close()`

    Close httplib2 connections.

`triggerPubsubExecution(workflow, body=None, x__xgafv=None)`

    Triggers a new execution using the latest revision of the given workflow by a Pub/Sub push notification.

    Args:
      workflow: string, Required. Name of the workflow for which an execution should be created. Format: projects/{project}/locations/{location}/workflows/{workflow} (required)
      body: object, The request body.
        The object takes the form of:

    { # Request for the TriggerPubsubExecution method.
      "GCPCloudEventsMode": "A String", # Required. LINT: LEGACY_NAMES The query parameter value for __GCP_CloudEventsMode, set by the Eventarc service when configuring triggers.
      "message": { # A message that is published by publishers and consumed by subscribers. The message must contain either a non-empty data field or at least one attribute. Note that client libraries represent this object differently depending on the language. See the corresponding [client library documentation](https://cloud.google.com/pubsub/docs/reference/libraries) for more information. See [quotas and limits] (https://cloud.google.com/pubsub/quotas) for more information about message limits. # Required. The message of the Pub/Sub push notification.
        "attributes": { # Attributes for this message. If this field is empty, the message must contain non-empty data. This can be used to filter messages on the subscription.
          "a_key": "A String",
        },
        "data": "A String", # The message data field. If this field is empty, the message must contain at least one attribute.
        "messageId": "A String", # ID of this message, assigned by the server when the message is published. Guaranteed to be unique within the topic. This value may be read by a subscriber that receives a `PubsubMessage` via a `Pull` call or a push delivery. It must not be populated by the publisher in a `Publish` call.
        "orderingKey": "A String", # If non-empty, identifies related messages for which publish order should be respected. If a `Subscription` has `enable_message_ordering` set to `true`, messages published with the same non-empty `ordering_key` value will be delivered to subscribers in the order in which they are received by the Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest` must specify the same `ordering_key` value.
        "publishTime": "A String", # The time at which the message was published, populated by the server when it receives the `Publish` call. It must not be populated by the publisher in a `Publish` call.
      },
      "subscription": "A String", # Required. The subscription of the Pub/Sub push notification. Format: projects/{project}/subscriptions/{sub}
    }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A running instance of a [Workflow](/workflows/docs/reference/rest/v1/projects.locations.workflows).
      "argument": "A String", # Input parameters of the execution represented as a JSON string. The size limit is 32KB. *Note*: If you are using the REST API directly to run your workflow, you must escape any JSON string value of `argument`. Example: `'{"argument":"{\"firstName\":\"FIRST\",\"lastName\":\"LAST\"}"}'`
      "callLogLevel": "A String", # The call logging level associated to this execution.
      "endTime": "A String", # Output only. Marks the end of execution, successful or not.
      "error": { # Error describes why the execution was abnormally terminated. # Output only. The error which caused the execution to finish prematurely. The value is only present if the execution's state is `FAILED` or `CANCELLED`.
        "context": "A String", # Human-readable stack trace string.
        "payload": "A String", # Error message and data returned represented as a JSON string.
        "stackTrace": { # A collection of stack elements (frames) where an error occurred. # Stack trace with detailed information of where error was generated.
          "elements": [ # An array of stack elements.
            { # A single stack element (frame) where an error occurred.
              "position": { # Position contains source position information about the stack trace element such as line number, column number and length of the code block in bytes. # The source position information of the stack trace element.
                "column": "A String", # The source code column position (of the line) the current instruction was generated from.
                "length": "A String", # The number of bytes of source code making up this stack trace element.
                "line": "A String", # The source code line number the current instruction was generated from.
              },
              "routine": "A String", # The routine where the error occurred.
              "step": "A String", # The step the error occurred at.
            },
          ],
        },
      },
      "name": "A String", # Output only. The resource name of the execution. Format: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}
      "result": "A String", # Output only. Output of the execution represented as a JSON string. The value can only be present if the execution's state is `SUCCEEDED`.
      "startTime": "A String", # Output only. Marks the beginning of execution.
      "state": "A String", # Output only. Current state of the execution.
      "workflowRevisionId": "A String", # Output only. Revision of the workflow this execution is using.
    }