Task 4 - Create a Schema
This task explains how to create a schema for your application.
A schema is an object in the Forge Schema service that represents a schema specification. A schema specification is a blueprint that describes how information is organized and constrained within a block of data. It is essentially a JSON specification that defines the constituents of the data. It provides a structure and set of rules to keep everything consistent and interoperable in a system.
Expected task outcome
By the end of this task you will be able to:
- Create a draft schema.
- Fetch a draft schema.
- Publish schema.
- Fetch a Published schema.
Endpoints used in this task
You will use the following API endpoints in this task:
Step 1 - Create a Draft Schema
In postman, Select Task 3 > POST Create a Draft Schema and click Send. The equivalent cURL request is as follows.
Request
|
In Postman, a script in the Tests tab saves the ID of the schema to a variable named DRAFT_SCHEMA_ID, so that it can be used in subsequent API calls.
Response
Step 2 - Fetch Draft Schema
In postman, Select Task 3 > GET Fetch Draft Schema request and click send. The equivalent cURL request is as follows.
Request
|
Response
Step 3 - Publish Schema
In postman, Select Task 3 > POST Publish Schema and click Send. The equivalent cURL request is as follows.
Note the extensionStatus attribute is Published.
Request
|
In postman, note the extensionStatus as published
Response
In Postman, a script in the Tests tab saves the ID of the schema to a variable named SCHEMA_ID, so that it can be used in subsequent API calls.
Step 4 - Fetch Published Schema
In postman, Select Task 3 > GET Fetch Published Schema and click Send. The equivalent cURL request is as follows.
Request
|