# Google API Common Protos Client - Class Api (4.14.0)

4.14.0 (latest) 4.13.0 4.12.5 4.11.0 4.10.0 4.9.0 4.8.3 Reference documentation and code samples for the Google API Common Protos Client class Api.

This message defines attributes associated with API operations, such as
a network API request. The terminology is based on the conventions used
by Google APIs, Istio, and OpenAPI.

Generated from protobuf message `google.rpc.context.AttributeContext.Api`

## Namespace

Google \\ Rpc \\ Context \\ AttributeContext

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ service` | `string` The API service name. It is a logical identifier for a networked API, such as "pubsub.googleapis.com". The naming syntax depends on the API management system being used for handling the request. |
| `↳ operation` | `string` The API operation name. For gRPC requests, it is the fully qualified API method name, such as "google.pubsub.v1.Publisher.Publish". For OpenAPI requests, it is the `operationId`, such as "getPet". |
| `↳ protocol` | `string` The API protocol used for sending the request, such as "http", "https", "grpc", or "internal". |
| `↳ version` | `string` The API version associated with the API operation above, such as "v1" or "v1alpha1". |

### getService

The API service name. It is a logical identifier for a networked API,
such as "pubsub.googleapis.com". The naming syntax depends on the
API management system being used for handling the request.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setService

The API service name. It is a logical identifier for a networked API,
such as "pubsub.googleapis.com". The naming syntax depends on the
API management system being used for handling the request.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getOperation

The API operation name. For gRPC requests, it is the fully qualified API
method name, such as "google.pubsub.v1.Publisher.Publish". For OpenAPI
requests, it is the `operationId`, such as "getPet".

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setOperation

The API operation name. For gRPC requests, it is the fully qualified API
method name, such as "google.pubsub.v1.Publisher.Publish". For OpenAPI
requests, it is the `operationId`, such as "getPet".

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getProtocol

The API protocol used for sending the request, such as "http", "https",
"grpc", or "internal".

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setProtocol

The API protocol used for sending the request, such as "http", "https",
"grpc", or "internal".

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getVersion

The API version associated with the API operation above, such as "v1" or
"v1alpha1".

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setVersion

The API version associated with the API operation above, such as "v1" or
"v1alpha1".

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |