diff --git a/middleware/apicurio/assets/airport-codes.json b/middleware/apicurio/assets/airport-codes.json new file mode 100644 index 000000000..edb7c4e6f --- /dev/null +++ b/middleware/apicurio/assets/airport-codes.json @@ -0,0 +1,191 @@ +{ + "swagger": "2.0", + "info": { + "description": "A super great RESTful API that allows developers to lookup the codes for all the major international airports. Also, the API allows adminstrators to add a new airport code as needed.", + "version": "0.0.9", + "title": "Airport Codes Lookup API", + "contact": { + "email": "reselbob@gmail.com" + }, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "host": "virtserver.swaggerhub.com", + "basePath": "/breselman/GoodAirportCodes/0.0.9", + "tags": [ + { + "name": "admins", + "description": "Secured Admin-only calls" + }, + { + "name": "developers", + "description": "Operations available to regular developers" + } + ], + "schemes": [ + "https" + ], + "paths": { + "/airportCodes/{code}": { + "get": { + "tags": [ + "developers" + ], + "summary": "gets a particular airport code", + "description": "Gets airport information that corresponds to the submitted aiport code.\n", + "operationId": "getAirportCode", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "code", + "in": "path", + "description": "The aiport code to lookup", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "the result that corresponds to the submitted airport code", + "schema": { + "$ref": "#/definitions/AirportCode" + } + }, + "400": { + "description": "bad input parameter", + "schema": { + "$ref": "#/definitions/AirportCodeInputError" + } + } + } + } + }, + "/airportCodes": { + "get": { + "tags": [ + "developers" + ], + "summary": "gets all airport codes that corresponds to the search term", + "description": "Gets airport information that corresponds to the submitted search term. If no search term is provides, all codes are returned\n", + "operationId": "searchAirportCodes", + "produces": [ + "application/json" + ], + "parameters": [ + { + "name": "searchterm", + "in": "query", + "description": "search term to process", + "required": false, + "type": "string" + } + ], + "responses": { + "200": { + "description": "the result that corresponds to the submitted search term", + "schema": { + "$ref": "#/definitions/AirportCodes" + } + }, + "400": { + "description": "bad request", + "schema": { + "$ref": "#/definitions/AirportCodeInputError" + } + } + } + }, + "post": { + "tags": [ + "admins" + ], + "summary": "adds a new Airport Code to the resource", + "description": "Adds an new aiport code to the resource\n", + "operationId": "setAirportCode", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "description": "The airport code to add", + "required": true, + "schema": { + "$ref": "#/definitions/AirportCode" + } + } + ], + "responses": { + "200": { + "description": "Returns the newly created airport code", + "schema": { + "$ref": "#/definitions/AirportCode" + } + }, + "400": { + "description": "bad input parameter", + "schema": { + "$ref": "#/definitions/AirportCodeInputError" + } + } + } + } + } + }, + "definitions": { + "AirportCodeInputError": { + "type": "object", + "properties": { + "message": { + "type": "string", + "example": "Bad input data" + } + } + }, + "AirportCode": { + "type": "object", + "required": [ + "airport", + "code" + ], + "properties": { + "airport": { + "type": "string", + "example": "Mock of Los Angeles International Aiport" + }, + "code": { + "type": "string", + "example": "LAX" + } + } + }, + "AirportCodes": { + "type": "array", + "items": { + "$ref": "#/definitions/AirportCode" + }, + "example": [ + { + "code": "LAX", + "description": "Los Angeles International Airport" + }, + { + "code": "LGA", + "description": "LaGuardia Airport" + }, + { + "code": "EWR", + "description": "Newark International Airport" + } + ] + } + } +} \ No newline at end of file diff --git a/middleware/apicurio/assets/apicurio.png b/middleware/apicurio/assets/apicurio.png new file mode 100644 index 000000000..ace17c33d Binary files /dev/null and b/middleware/apicurio/assets/apicurio.png differ diff --git a/middleware/apicurio/assets/command.png b/middleware/apicurio/assets/command.png new file mode 100644 index 000000000..68219682a Binary files /dev/null and b/middleware/apicurio/assets/command.png differ diff --git a/middleware/apicurio/assets/schema-registry.png b/middleware/apicurio/assets/schema-registry.png new file mode 100644 index 000000000..031ac6887 Binary files /dev/null and b/middleware/apicurio/assets/schema-registry.png differ diff --git a/middleware/apicurio/assets/seatsaver.proto b/middleware/apicurio/assets/seatsaver.proto new file mode 100644 index 000000000..a7ea17909 --- /dev/null +++ b/middleware/apicurio/assets/seatsaver.proto @@ -0,0 +1,100 @@ +syntax = "proto3"; + +package seatsaver; + +option objc_class_prefix = "SEATSAVER"; + +/* Describes a customer associated with a seat. */ +message Customer { + string firstName = 1; + string lastName = 2; + string email = 3; + string created = 4; + string message = 5; +} +/* Describes a possible status of a seat */ +enum Status { + RELEASING = 0; + OPEN = 1; + RESERVING = 2; + RESERVED = 3; + SELLING = 4; + SOLD = 5; +} + +/* Describes a seat */ +message Seat { + string id = 1; + string number = 2; + string section = 3; + Status status = 4; + string changed = 5; + string created = 6; + Customer customer = 7; + string message = 8; +} + +/* Describes a venue that has seats */ +message Venue { + string id = 1; + string name = 2; + string address = 3; + string city = 4; + string state_province = 5; + string postal_code = 6; + string country = 7; + string changed = 8; + string created = 9; + repeated Seat seats = 10; + string message = 11; +} + +message Authentication { + string authenticationId = 1; + string message = 2; +} +message VenueRequest { + string venueId = 1; + string authenticationId = 2; +} + +message SeatRequest { + string venueId = 1; + string seatId = 2; + string authenticationId = 3; +} + +message SeatStatusRequest { + string venueId = 1; + Seat seat = 2; + string authenticationId = 3; +} + +message PingRequest { + string authenticationId = 1; + int32 streamItemCount = 2; +} + +message PingResponse { + string runtimeInfo = 1; + string message = 2; +} + +message VenuesResponse { + repeated Venue venues = 1; + string message = 2; +} + +service SeatSaverService { + rpc GetVenues(Authentication) returns (stream Venue) {} + rpc GetVenue(VenueRequest) returns (Venue) {} + rpc GetOpenSeats(VenueRequest) returns (stream Seat) {} + rpc GetSoldSeats(VenueRequest) returns (stream Seat) {} + rpc GetReservedSeats(VenueRequest) returns (stream Seat) {} + rpc GetSeats(VenueRequest) returns (stream Seat) {} + rpc ReserveSeat(SeatStatusRequest) returns (Seat) {} + rpc ReleaseSeat(SeatStatusRequest) returns (Seat) {} + rpc BuySeat(SeatStatusRequest) returns (Seat) {} + rpc Ping(PingRequest) returns (PingResponse) {} + rpc PingStream(PingRequest) returns (stream PingResponse) {} +} \ No newline at end of file diff --git a/middleware/apicurio/assets/simple.json b/middleware/apicurio/assets/simple.json new file mode 100644 index 000000000..1c499f638 --- /dev/null +++ b/middleware/apicurio/assets/simple.json @@ -0,0 +1,30 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Big Bob's Thinking Tools", + "description": "A product from Big Bob's Thinking Tools catalog", + "type": "object", + "properties": { + "id": { + "description": "The unique identifier for a product", + "type": "integer" + }, + "name": { + "description": "Name of the product", + "type": "string" + }, + "price": { + "type": "number", + "minimum": 0, + "exclusiveMinimum": true + }, + "tags": { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1, + "uniqueItems": true + } + }, + "required": ["id", "name", "price"] +} \ No newline at end of file diff --git a/middleware/apicurio/assets/simple.proto b/middleware/apicurio/assets/simple.proto new file mode 100644 index 000000000..898fd4f49 --- /dev/null +++ b/middleware/apicurio/assets/simple.proto @@ -0,0 +1,66 @@ +syntax = "proto3"; + +package simplegrpc; + +/* Describes an array of floats to be processed */ +message Request { + repeated double numbers = 1; +} + +/* Describes the result of processing */ +message Response { + double result = 1; +} + +/* Describes the request for a repeated value + value, the string to repeat + limit, the number of times to repeat + */ +message RepeatRequest { + string value = 1; + int32 limit = 2; +} + +/* Describes the response for a repeated value + value, the repeated string + limit, the ordinal position in the response stream + */ +message RepeatResponse { + string value = 1; + int32 counter = 2; +} + +/* Describes the response from a Ping call + */ +message PingResponse { + string result = 1; +} + +/* Describes the request to a Ping call + */ +message PingRequest { + string data = 1; +} + +service SimpleService { + rpc Add (Request) returns (Response) { + } + + rpc Subtract (Request) returns (Response) { + } + + rpc Multiply (Request) returns (Response) { + } + + rpc Divide (Request) returns (Response) { + } + + rpc Repeat (RepeatRequest) returns (stream RepeatResponse) { + } + + rpc Ping (PingRequest) returns (PingResponse) { + } + + rpc Pings (PingRequest) returns (repeated PingResponse) { + } +} \ No newline at end of file diff --git a/middleware/apicurio/finish.md b/middleware/apicurio/finish.md new file mode 100644 index 000000000..bd2289949 --- /dev/null +++ b/middleware/apicurio/finish.md @@ -0,0 +1,10 @@ +**Congratulations!** You've completed the scenario, ***Working with a Schema Registry Using Apicurio***. + + +This interactive scenario demonstrated how to: + +* Installed Apicurio under Docker +* Added schemas to the registry +* Used the Apicurio web page +* Worked with the Apicurio API at the command line + diff --git a/middleware/apicurio/index.json b/middleware/apicurio/index.json new file mode 100644 index 000000000..90b4c9dbc --- /dev/null +++ b/middleware/apicurio/index.json @@ -0,0 +1,48 @@ +{ + "title": "Working with a Schema Registry Using Apicurio", + "description": "Learn how to setup and use a schema registry to serve as a single source of truth for data structures", + "difficulty": "Basic Understanding of Data Schemas", + "time": "15 minutes", + "details": { + "steps": [{ + "title": "Installing Apicurio under Docker", + "text": "step01.md" + }, + { + "title": "Adding schemas to the registry", + "text": "step02.md" + }, + { + "title": "Using the Apicurio web interface", + "text": "step03.md" + }, + { + "title": "Working with the Apicurio API at the command line", + "text": "step04.md" + } + ], + "intro": { + "text": "intro.md", + "credits": "" + }, + "finish": { + "text": "finish.md" + }, + "assets": { + "host01": [ + {"file": "airport-codes.json", "target": "/root/"}, + {"file": "simple.proto", "target": "/root/"}, + {"file": "simple.json", "target": "/root/"}, + {"file": "seatsaver.proto", "target": "/root/"} + ] + } + }, + "environment": { + "showide": true, + "uilayout": "terminal", + "uimessage1": "\u001b[32mYour Interactive Bash Terminal for Working with Apicurio\u001b[m\r\n" + }, + "backend": { + "imageid": "ubuntu" + } +} \ No newline at end of file diff --git a/middleware/apicurio/intro.md b/middleware/apicurio/intro.md new file mode 100644 index 000000000..91bd389fe --- /dev/null +++ b/middleware/apicurio/intro.md @@ -0,0 +1,36 @@ +## Objective + +The objectives of this scenario are to familiarize you with the concept of a schema registry and to get experience using one. + +In this scenario we'll use the schema registry published by [Apricurio](https://www.apicur.io/registry/). + + +## What you need to know to start + +In order to get full benefit from taking this scenario it helps to have a basic understanding of the usefulness of a schema registry and the pupose it serves when managing data in a distributed architecture. + +Essentially a schema registry is a single source of truth for defining data schemas. Developers store schemas that describe the various data structures used by their services and APIs in a schema registry. Consumers query the schema registry to discover the schema(s) of the data that is to be submitted to and will be emitted from the given service or API. + +![using a schema registry](apicurio/assets/schema-registry.png) + +Server side developers and machine intelligence can use a schema registry to validate data coming into a service. Client side consumers can use a schema registry to ensure that data being submitted to a target conforms to the structure and types expected by the given service. + + +## Contents + +This scenario is divided into the following lessons. + +* **Lesson 1** - Install Apicurio under Docker +* **Lesson 2** - Add schemas to the registry +* **Lesson 3** - Use the Apicurio web interface +* **Lesson 4** - Work with the Apicurio API at the command line + +## Executing command line instructions + +This scenario is completely interactive. The instructions you'll be given will be executed directly in the terminal window that is embedded in the Katacoda interactive learning environment. In the steps to come, when you see a command line instruction with a black background and check mark at the end, like so: + +![Katacoda command line](kind-intro/assets/command.png) + +just click on it and the command will execute in the interactive terminal window. + +Click the START SCENARIO button to start. diff --git a/middleware/apicurio/step01.md b/middleware/apicurio/step01.md new file mode 100644 index 000000000..80aec50ff --- /dev/null +++ b/middleware/apicurio/step01.md @@ -0,0 +1,26 @@ +## Objective +The objective of this lesson is to install the Apicurio schema registry as a Docker container. + +## Steps + +**Step 1:** Download the Docker image + +`docker pull apicurio/apicurio-registry-mem:1.3.2.Final`{{execute}} + +**Step 2:** Create the Docker container for Apicurio + +`docker run -d -p 8080:8080 apicurio/apicurio-registry-mem:1.3.2.Final`{{execute}} + +**Step 3:** Confirm that the Apicurio schema registry is up and running by making a `curl` call against it. + +`curl localhost:8080/api/artifacts`{{execute}} + +You'll get a response as follows because no schemas have been added to the schema registry: + +`[]` + +**BEWARE:** Sometimes it can take a minute or two for Apicurio to initialize in the Katacoda VM. Thus, you might have to click the `curl` command shown above in Step 3 a few times to get the expected response. + +--- + +***Next: Adding schemas to the registry*** diff --git a/middleware/apicurio/step02.md b/middleware/apicurio/step02.md new file mode 100644 index 000000000..a4b05a6ef --- /dev/null +++ b/middleware/apicurio/step02.md @@ -0,0 +1,163 @@ +## Objective + +The objective of this lesson is to add schemas to the registry using the Apicurio API. + +## What you'll be doing + +In this lesson you are going to upload schemas to the Apicurio schema registry via the Apicurio API. Also, you're going to use the Apicurio API to add metadata about each schema. The schemas you're going to upload are in files that were automatically added to the Katacoda interactive learning enviornment when the Katacoda virtual machine started for this session. + + +## Adding Schemas +In the following steps you're going to add an [OpenApi](https://www.openapis.org/) schema, two [gRPC](https://grpc.io/)/[Protocol Buffers](https://developers.google.com/protocol-buffers/) schemas, and a schema in [JSON Schema](https://json-schema.org/) format. + +### Add an OpenApi Schema + +**Step 1:** Add a schema in [OpenApi](https://www.openapis.org/) format and assign the data in the response to the environment variable `RESPONSE`. + +`RESPONSE=$(curl -s -X POST localhost:8080/api/artifacts -H "Content-Type: application/json" -H "X-Registry-ArtifactType: OPENAPI" --data-binary "@airport-codes.json") && echo $RESPONSE | json_pp -json_opt pretty,canonical`{{execute}} + +You'll get output similar to the following: + +``` +{ + "createdOn" : 1614271164921, + "description" : "A super great RESTful API that allows developers to lookup the codes for all the major international airports. Also, the API allows adminstrators to add a new airport code as needed.", + "globalId" : 1, + "id" : "68212a0e-6651-44b8-a033-50c82e6b8632", + "modifiedOn" : 1614271164921, + "name" : "Airport Codes Lookup API", + "state" : "ENABLED", + "type" : "OPENAPI", + "version" : 1 +} + +``` + +Now add a label as metadata for the uploaded schema. + +**Step 2:** Get the ID of the schema as issued by the schema registry and assign it to the environment variable `RESPONSE_ID`. + +`RESPONSE_ID=$(echo $RESPONSE | jq '.id' | sed -e 's/^"//' -e 's/"$//') && echo $RESPONSE_ID`{{execute}} + +You'll get output similar to the following. (Your `id` value will differ according to your Katacoda session.) + +`4c4cb7ed-dc8f-4497-b5c7-9ee4f1507fad` + +**Step 3:** Use the `curl` command to add the label `transportation` to the schema entry. + +`curl -i -X PUT localhost:8080/api/artifacts/$RESPONSE_ID/meta -H "Content-Type: application/json" --data '{"labels": ["transportation"] }'`{{execute}} + +You'll get a response similar to the following: + +``` +HTTP/1.1 204 No Content +Date: Thu, 25 Feb 2021 18:15:50 GMT +Expires: Wed, 24 Feb 2021 18:15:50 GMT +Pragma: no-cache +Cache-control: no-cache, no-store, must-revalidate +``` + +### Add a Protocol Buffers Schema + +**Step 1:** Add a simple schema in [Protocol Buffers](https://developers.google.com/protocol-buffers/) format and assign the data in the response to the environment variable `RESPONSE`. + +`RESPONSE=$(curl -s -X POST localhost:8080/api/artifacts -H "Content-Type: application/x-protobuf" -H "X-Registry-ArtifactType: PROTOBUF" --data-binary "@simple.proto") && echo $RESPONSE`{{execute}} + +You'll get output similar to the following: + +``` +{"createdOn":1614277541722,"modifiedOn":1614277541722,"id":"a528691e-e318-4397-a958-93b3b3369f9b","version":1,"type":"PROTOBUF","globalId":2,"state":"ENABLED"} +``` + +**Step 2:** Get the ID of the schema as issued by the schema registry and assign it to the environment variable `RESPONSE_ID`. + +`RESPONSE_ID=$(echo $RESPONSE | jq '.id' | sed -e 's/^"//' -e 's/"$//') && echo $RESPONSE_ID`{{execute}} + +You'll get output similar to the following. (Your `id` value will differ according to your Katacoda session.) + +`e837f91e-3cab-4bea-914d-0694fb48d5af` + +**Step 3:** Name the schema entry in Apicurio, `Simple Schema` using `curl` against the Apicurio API. + +`curl -i -X PUT localhost:8080/api/artifacts/$RESPONSE_ID/meta -H "Content-Type: application/json" --data '{"name": "Simple Schema" }'`{{execute}} + +You'll get a response similar to the following: + +``` +HTTP/1.1 204 No Content +Date: Thu, 25 Feb 2021 18:18:36 GMT +Expires: Wed, 24 Feb 2021 18:18:36 GMT +Pragma: no-cache +Cache-control: no-cache, no-store, must-revalidate +``` +### Add an Advanced Protocol Buffers Schema + +**Step 1:** Add a more advanced schema in [Protocol Buffers](https://developers.google.com/protocol-buffers/) format and assign the data in the response to the environment variable `RESPONSE`. + +`RESPONSE=$(curl -s -X POST localhost:8080/api/artifacts -H "Content-Type: application/x-protobuf" -H "X-Registry-ArtifactType: PROTOBUF" --data-binary "@seatsaver.proto") && echo $RESPONSE`{{execute}} + +You'll get output similar to the following: + +``` +{"createdOn":1614277658840,"modifiedOn":1614277658840,"id":"7ca49a5f-7083-49f0-911f-f6be060fd90c","version":1,"type":"PROTOBUF","globalId":3,"state":"ENABLED"} + +``` + +**Step 2:** Get the ID of the schema as issued by the schema registry and assign it to the environment variable `RESPONSE_ID`. + +`RESPONSE_ID=$(echo $RESPONSE | jq '.id' | sed -e 's/^"//' -e 's/"$//') && echo $RESPONSE_ID`{{execute}} + +You'll get output similar to the following. (Your `id` value will differ according to your Katacoda session.) + +`7ca49a5f-7083-49f0-911f-f6be060fd90c` + +**Step 3:** Set the Protocol Buffer schema's Name to `Seat Saver` in Apicurio using `curl` against the Apicurio API. + +`curl -i -X PUT localhost:8080/api/artifacts/$RESPONSE_ID/meta -H "Content-Type: application/json" --data '{"name": "Seat Saver" }'`{{execute}} + +You'll get a response similar to the following: + +``` +HTTP/1.1 204 No Content +Date: Thu, 25 Feb 2021 18:28:36 GMT +Expires: Wed, 24 Feb 2021 18:28:36 GMT +Pragma: no-cache +Cache-control: no-cache, no-store, must-revalidate +``` + +### Add a JSON Schema + +**Step 1:** Add a schema in [JSON Schema](https://json-schema.org/) format and assign the data in the response to the environment variable `RESPONSE`. + +`RESPONSE=$(curl -s -X POST localhost:8080/api/artifacts -H "Content-Type: application/json" -H "X-Registry-ArtifactType: JSON" --data-binary "@simple.json") && echo $RESPONSE`{{execute}} + +You'll get output similar to the following: + +``` +{"name":"Big Bob's Thinking Tools","description":"A product from Big Bob's Thinking Tools catalog","createdOn":1614277836940,"modifiedOn":1614277836940,"id":"2411dd45-931a-4706-8cdf-ea3fe3fb56e3","version":1,"type":"JSON","globalId":4,"state":"ENABLED"} +``` +**Step 2:** Get the ID of the schema as issued by the schema registry and assign it to the environment variable `RESPONSE_ID`. + +`RESPONSE_ID=$(echo $RESPONSE | jq '.id' | sed -e 's/^"//' -e 's/"$//') && echo $RESPONSE_ID`{{execute}} + +You'll get output similar to the following. (Your `id` value will differ according to your Katacoda session.) + +`2411dd45-931a-4706-8cdf-ea3fe3fb56e3` + +**Step 3:** Add the labels `tool` and `utility` to the schema entry in Apicurio. + +`curl -i -X PUT localhost:8080/api/artifacts/$RESPONSE_ID/meta -H "Content-Type: application/json" --data '{"labels": ["tool", "utility"] }'`{{execute}} + +You'll get a response similar to the following: + +``` +HTTP/1.1 204 No Content +Date: Thu, 04 Mar 2021 16:52:50 GMT +Expires: Wed, 03 Mar 2021 16:52:50 GMT +Pragma: no-cache +Cache-control: no-cache, no-store, must-revalidate +``` + + +--- +***Next: Using the Apicurio web interface*** diff --git a/middleware/apicurio/step03.md b/middleware/apicurio/step03.md new file mode 100644 index 000000000..3f89ab977 --- /dev/null +++ b/middleware/apicurio/step03.md @@ -0,0 +1,21 @@ +## Objective +The object of this scenario is bring up the Apicurio web site running in the Katacoda interactive learning environment, + + +## Steps + +**Step 1:** Bring up the Apicurio web site in a separate tab in your browser by clicking the link below. + +https://[[HOST_SUBDOMAIN]]-8080-[[KATACODA_HOST]].environments.katacoda.com/ui + +**BEWARE:** Sometimes it can take a minute or two for Apicurio to initialize the web server that publishes the Web UI. Thus, you might have to click the URL shown above a few times to get the page to load without error. + + +**Step 2:** Notice that the schemas loaded into the schema registry via the Apicurio API now appear in the main web page: + +![Apicurio UI](apicurio/assets/apicurio.png) + +Feel free to inspect the schemas by clicking the View Details button at the right of each schema. + +--- +***Next: Searching the Apicurio API at the command line*** diff --git a/middleware/apicurio/step04.md b/middleware/apicurio/step04.md new file mode 100644 index 000000000..9284e6721 --- /dev/null +++ b/middleware/apicurio/step04.md @@ -0,0 +1,166 @@ +## Objective +The objective of this lesson is to use the Apicurio API to perform various searches for schemas stored in the schema registry. + +## What you'll be doing + +In this lesson you will conduct the following searches + +* Get a list of the IDs of all artifacts stored in the schema registry +* Get the first schema from the list of artifact IDs +* Get all the schemas or schema descriptions that have the term `Bob` +* Get all the Protocol Buffer schemas + + +## Steps + +**Step 1:** Get a list of IDs of all the artifacts stored in the schema registry. Format the output as JSON. + +`SCHEMAS=$(curl -s localhost:8080/api/artifacts) && echo $SCHEMAS`{{execute}} + +`["0cee3836-5a0a-47f4-a647-baedf6246f25","10b69421-0a31-4f8c-ac99-87173bf09a63","e36f1780-b4e1-4663-8848-67743d99a457","9abed1f6-366c-4186-872f-c442079ea9ae"]` + +**Step 2:** Get the schema associated with the first artifact ID. + + +`SCHEMA_ID=$(echo $SCHEMAS | jq '.[0]' | sed -e 's/^"//' -e 's/"$//') && echo $SCHEMA_ID`{{execute}} + +You'll get output similar to the following: + +`ce60dcd4-9063-4685-b8cc-7a259da78f17` + +`curl -s localhost:8080/api/artifacts/$SCHEMA_ID`{{execute}} + +The output you get will be determined by the type of schema retrieved. For example, you might get back one of the PROTOBUF schemas. In that case your response will look like the following: + +``` +syntax = "proto3"; + +package simplegrpc; + +/* Describes an array of floats to be processed */ +message Request { + repeated double numbers = 1; +} + +/* Describes the result of processing */ +message Response { + double result = 1; +} + +/* Describes the request for a repeated value + value, the string to repeat + limit, the number of times to repeat + */ +message RepeatRequest { + string value = 1; + int32 limit = 2; +} + +/* Describes the response for a repeated value + value, the repeated string + limit, the ordinal position in the response stream + */ +message RepeatResponse { + string value = 1; + int32 counter = 2; +} + +/* Describes the response from a Ping call + */ +message PingResponse { + string result = 1; +} + +/* Describes the request to a Ping call + */ +message PingRequest { + string data = 1; +} + +service SimpleService { + rpc Add (Request) returns (Response) { + } + + rpc Subtract (Request) returns (Response) { + } + + rpc Multiply (Request) returns (Response) { + } + + rpc Divide (Request) returns (Response) { + } + + rpc Repeat (RepeatRequest) returns (stream RepeatResponse) { + } + + rpc Ping (PingRequest) returns (PingResponse) { + } + + rpc Pings (PingRequest) returns (repeated PingResponse) { + } +} +``` + + +**Step 3:** Search the registry for artifacts that contain the term `Bob` and return the results in JSON format. + +`curl -s localhost:8080/api/search/artifacts?search=Bob | json_pp -json_opt pretty,canonical`{{execute}} + +You'll get results similar to the following: + +``` +{ + "artifacts" : [ + { + "createdOn" : 1614227597726, + "description" : "A product from Big Bob's Thinking Tools catalog", + "id" : "ff96e3e3-8afc-4e26-b154-9a53895acbae", + "modifiedOn" : 1614227597726, + "name" : "Big Bob's Thinking Tools", + "state" : "ENABLED", + "type" : "JSON" + } + ], + "count" : 1 +} + +``` + + + +**Step 4:** Search the schema registry for schemas of type, `PROTOBUF` + + +`curl -s localhost:8080/api/search/artifacts?search=PROTOBUF | json_pp -json_opt pretty,canonical`{{execute}} + +You'll get results similar to the following: + +``` +{ + "artifacts" : [ + { + "createdOn" : 1614278635241, + "id" : "01c40a46-cfff-4ce5-a315-72197a81afac", + "modifiedOn" : 1614278635241, + "name" : "Seat Saver", + "state" : "ENABLED", + "type" : "PROTOBUF" + }, + { + "createdOn" : 1614278620827, + "id" : "ce60dcd4-9063-4685-b8cc-7a259da78f17", + "modifiedOn" : 1614278620827, + "name" : "Simple Schema", + "state" : "ENABLED", + "type" : "PROTOBUF" + } + ], + "count" : 2 +} + + +``` + +--- + +***Congratulations! You've finished the secnario.***