Operations represent the actions available on a service. Each operation has a unique name, an HTTP method, and a URI.
Key attributes for an operation include:
httpMethod: The HTTP verb (e.g., GET, POST, PUT, DELETE, PATCH).uri: The endpoint URI, which can use URI templates (e.g., /users/{id}). Variables in the template become parameters with location: "uri".responseClass: Defines what getResult() returns. Can be primitive, a class name (must implement Guzzle\Service\Command\ResponseClassInterface), or a model name.responseType: The type of response (primitive, class, model, or documentation). Defaults to primitive if not specified.errorResponses: An array of objects defining potential errors. Each object can contain code (HTTP status), reason (description), and class (the exception class to raise).additionalParameters: A catch-all rule for parameters not explicitly defined. This is useful for APIs with many similar parameters (e.g., Twitter's query string parameters).parameters: An object defining specific input data for the request.
{
"operations": {
"operationName": {
"extends": "string",
"httpMethod": "GET|POST|PUT|DELETE|PATCH|string",
"uri": "string",
"summary": "string",
"class": "string",
"responseClass": "string",
"responseNotes": "string",
"type": "string",
"description": "string",
"responseType": "primitive|class|(model by name)|documentation|(string)",
"deprecated": false,
"errorResponses": [
{
"code": 500,
"reason": "Unexpected Error",
"class": "string"
}
],
"data": {
"foo": "bar",
"baz": "bam"
},
"parameters": {}
}
}
}