All Products
Search
Document Center

Create Model

Last Updated: Jul 12, 2019

Description

You can call this operation to create a data model that describes data in API requests or responses.

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

  1. https://apigateway.cn-qingdao.aliyuncs.com/?Action=CreateModel
  2. &GroupId=30e792398d6c4569b04c0e53a3494381
  3. &ModelName=Test
  4. &Schema={"type":"object","properties":{"id":{"format":"int64","maximum":100,"exclusiveMaximum":true,"type":"integer"},"name":{"maxLength":10,"type":"string"}}}
  5. &Description=Model Description
  6. &<Common request parameters>

Sample responsesXML format

  1. <CreateModelResponse>
  2. <ModelId>766c0b9538a04bdf974953b5576783ba</ModelId>
  3. <Description>Model Description</Description>
  4. <CreatedTime>2019-01-29T09:33:01Z</CreatedTime>
  5. <ModelName>Test</ModelName>
  6. <RequestId>4173F95B-360C-460C-9F6C-4A960B904411</RequestId>
  7. <Schema>{\"type\":\"object\",\"properties\":{\"id\":{\"format\":\"int64\",\"maximum\":100,\"exclusiveMaximum\":true,\"type\":\"integer\"},\"name\":{\"maxLength\":10,\"type\":\"string\"}}}"</Schema>
  8. <ModelRef>https://apigateway.aliyun.com/models/30e792398d6c4569b04c0e53a3494381/766c0b9538a04bdf974953b5576783ba</ModelRef>
  9. <ModifiedTime>2019-01-29T09:33:01Z</ModifiedTime>
  10. <GroupId>30e792398d6c4569b04c0e53a3494381</GroupId>
  11. </CreateModelResponse>

JSON format

  1. {
  2. "ModelId": "766c0b9538a04bdf974953b5576783ba",
  3. "Description": "Model Description",
  4. "CreatedTime": "2019-01-29T09:33:01Z",
  5. "ModelName": "Test",
  6. "RequestId": "4173F95B-360C-460C-9F6C-4A960B904411",
  7. "Schema": "{\"type\":\"object\",\"properties\":{\"id\":{\"format\":\"int64\",\"maximum\":100,\"exclusiveMaximum\":true,\"type\":\"integer\"},\"name\":{\"maxLength\":10,\"type\":\"string\"}}}",
  8. "ModelRef": "https://apigateway.aliyun.com/models/30e792398d6c4569b04c0e53a3494381/766c0b9538a04bdf974953b5576783ba",
  9. "ModifiedTime": "2019-01-29T09:33:01Z",
  10. "GroupId": "30e792398d6c4569b04c0e53a3494381"
  11. }