Success
A 200 response with data.
Parameter | Type | Description |
---|---|---|
status | integer | The HTTP status code |
message | string | The message to return |
data | any | The data to return |
Formats
Section titled “Formats”A JSON example of this model.
{ "status": 200, "message": "Success", "data": { "id": "123", "name": "Test 1" }}
The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: Success.yamltype: objectproperties: status: type: integer minimum: -2147483648 maximum: 2147483647 examples: - 200 message: type: string examples: - Successrequired: - status - message
The TypeSpec code for this model.
model Success { @example(200) status: int32;
@example("Success") message: string;}
Here’s an example of how to use the Ok
response within a an API operation:
import "@common-grants/core";import "@typespec/http";
using TypeSpec.Http;using CommonGrants.Responses;
model TestModel { id: string; name: string;}
@summary("Get test")@doc("Get a test model")@getop getTest(): Ok<TestModel>;