Description
You can call this operation to create a data model that describes data in API requests or responses.
- For more information about how to create a model, see JSON Schema Draft-04 and Model management.
- The properties of JSON Schemas must be objects.
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
Action | String | Yes | The operation that you want to perform. Set this parameter to CreateModel. |
GroupId | String | Yes | The ID of the group for which a model is created. |
ModelName | String | Yes | The name of the model to be created. The name must be unique within a group. |
Schema | String | Yes | The JSON Schema of the model to be created. |
Description | String | No | The description of the model to be created. |
Response parameters
Parameter | Type | Description |
---|---|---|
RequestId | String | The ID of the request. |
ModelId | String | The ID of the created model. |
ModelRef | String | The URI of the created model. |
ModelName | String | The name of the created model. |
GroupId | String | The ID of the group to which the created model belongs. |
Schema | String | The schema of the created model. |
RegionId | String | The ID of the region where the model is created. |
Description | String | The description of the created model. |
CreatedTime | String | The time when the model was created. |
ModifiedTime | String | The last time when the created model was modified. |
Examples
Sample requests
https://apigateway.cn-qingdao.aliyuncs.com/?Action=CreateModel
&GroupId=30e792398d6c4569b04c0e53a3494381
&ModelName=Test
&Schema={"type":"object","properties":{"id":{"format":"int64","maximum":100,"exclusiveMaximum":true,"type":"integer"},"name":{"maxLength":10,"type":"string"}}}
&Description=Model Description
&<Common request parameters>
Sample responsesXML
format
<CreateModelResponse>
<ModelId>766c0b9538a04bdf974953b5576783ba</ModelId>
<Description>Model Description</Description>
<CreatedTime>2019-01-29T09:33:01Z</CreatedTime>
<ModelName>Test</ModelName>
<RequestId>4173F95B-360C-460C-9F6C-4A960B904411</RequestId>
<Schema>{\"type\":\"object\",\"properties\":{\"id\":{\"format\":\"int64\",\"maximum\":100,\"exclusiveMaximum\":true,\"type\":\"integer\"},\"name\":{\"maxLength\":10,\"type\":\"string\"}}}"</Schema>
<ModelRef>https://apigateway.aliyun.com/models/30e792398d6c4569b04c0e53a3494381/766c0b9538a04bdf974953b5576783ba</ModelRef>
<ModifiedTime>2019-01-29T09:33:01Z</ModifiedTime>
<GroupId>30e792398d6c4569b04c0e53a3494381</GroupId>
</CreateModelResponse>
JSON
format
{
"ModelId": "766c0b9538a04bdf974953b5576783ba",
"Description": "Model Description",
"CreatedTime": "2019-01-29T09:33:01Z",
"ModelName": "Test",
"RequestId": "4173F95B-360C-460C-9F6C-4A960B904411",
"Schema": "{\"type\":\"object\",\"properties\":{\"id\":{\"format\":\"int64\",\"maximum\":100,\"exclusiveMaximum\":true,\"type\":\"integer\"},\"name\":{\"maxLength\":10,\"type\":\"string\"}}}",
"ModelRef": "https://apigateway.aliyun.com/models/30e792398d6c4569b04c0e53a3494381/766c0b9538a04bdf974953b5576783ba",
"ModifiedTime": "2019-01-29T09:33:01Z",
"GroupId": "30e792398d6c4569b04c0e53a3494381"
}