Producing Using Rest Client
Creating A REST Producer
When you have completed this step, you will have produced data in AVRO format to the stream you have configured in Creating topics.
| REST client doesn’t support SASLauthentication. If you want to useSASL, we recommend to use Kafka client. | 
Prerequisites
- 
Tool that is able to send and receive HTTP messages, such as curlorhttp
- 
A running instance of Rest Proxy (in the examples below it is accessible on the url https://192.168.99.100:18100, if you are using the SaaS Trial environment, the url you need to use can be found in theREADME.txtfile within the essentials-package)
Get Schema Id
In the following example we will use the /schemas endpoint to obtain the schema ids.
To produce the data, first we need a schemaId. Use below command to get the schemaId.
curl --request POST \
  --url "https://192.168.99.100:18100/schema/example/applicationlogevents" \
  --header "Content-Type: application/json" \
  --key ../client-cert/local-config/security/applications/example-producer/pem/example_producer.key \
  --cert ../client-cert/local-config/security/applications/example-producer/cer/example_producer.cer \
  --cacert ../client-cert/local-config/security/applications/common-truststore/cachain/tenant-root-ca.cert.pem \
  --data '
  {
    "keySchema": "{\"type\":\"record\",\"name\":\"Application\",\"namespace\":\"io.axual.client.example.schema\",\"doc\":\"Identification of an application\",\"fields\":[{\"name\":\"name\",\"type\":\"string\",\"doc\":\"The name of the application\"},{\"name\":\"version\",\"type\":[\"null\",\"string\"],\"doc\":\"(Optional) The application version\",\"default\":null},{\"name\":\"owner\",\"type\":[\"null\",\"string\"],\"doc\":\"The owner of the application\",\"default\":null}]}",
    "valueSchema": "{\"type\":\"record\",\"name\":\"ApplicationLogEvent\",\"namespace\":\"io.axual.client.example.schema\",\"doc\":\"Generic application log event\",\"fields\":[{\"name\":\"timestamp\",\"type\":\"long\",\"doc\":\"Timestamp of the event\"},{\"name\":\"source\",\"type\":{\"type\":\"record\",\"name\":\"Application\",\"doc\":\"Identification of an application\",\"fields\":[{\"name\":\"name\",\"type\":\"string\",\"doc\":\"The name of the application\"},{\"name\":\"version\",\"type\":[\"null\",\"string\"],\"doc\":\"(Optional) The application version\",\"default\":null},{\"name\":\"owner\",\"type\":[\"null\",\"string\"],\"doc\":\"The owner of the application\",\"default\":null}]},\"doc\":\"The application that sent the event\"},{\"name\":\"context\",\"type\":{\"type\":\"map\",\"values\":\"string\"},\"doc\":\"The application context, contains application-specific key-value pairs\"},{\"name\":\"level\",\"type\":{\"type\":\"enum\",\"name\":\"ApplicationLogLevel\",\"doc\":\"The level of the log message\",\"symbols\":[\"DEBUG\",\"INFO\",\"WARN\",\"ERROR\",\"FATAL\"]},\"doc\":\"The log level, being either DEBUG, INFO, WARN or ERROR\"},{\"name\":\"message\",\"type\":\"string\",\"doc\":\"The log message\"}]}"
  }'| Check your essentials-package for the key,certandcacertparameter values, see also Security. | 
When you execute above command, as a response it will return keyId and valueId like this:
{
   "keyId":1,
   "valueId":2
}For more detailed information to get schemaId, please refer Rest-Proxy Avro Schema Service
Producing Data
In the following example we will use the /streams endpoint to produce.
Use above keyId and valueId as keyMessage schemaId and valueMessage schemaId to produce a message:
curl --request POST \
  --url "https://192.168.99.100:18100/stream/example/applicationlogevents" \
  --header "axual-application-id: io.axual.example.client.avro.producer" \
  --header "axual-application-version: 1.0" \
  --header "axual-producer-uuid: log-producer1" \
  --header "Content-Type: application/json" \
  --key ../client-cert/local-config/security/applications/example-producer/pem/example_producer.key \
  --cert ../client-cert/local-config/security/applications/example-producer/cer/example_producer.cer \
  --cacert ../client-cert/local-config/security/applications/common-truststore/cachain/tenant-root-ca.cert.pem \
  --data '
  {
     "keyMessage":{
        "type":"AVRO",
        "schemaId": 1,
        "message":"{\"name\": \"logeventproducer\", \"version\": \"0.0.1\", \"owner\": \"none\"}"
     },
     "valueMessage":{
        "type":"AVRO",
        "schemaId": 2,
        "message":"{\"timestamp\": 1009, \"source\": {\"name\": \"logeventproducer\", \"version\": \"0.0.1\", \"owner\": \"Team Log\"}, \"context\": {\"Some key\": \"Some Value\"}, \"level\": \"INFO\", \"message\": \"Message 9\"}"
     }
  }'| Check your essentials-package for the key,certandcacertparameter values, see also Security. | 
When you execute above command, this will return response that will look like this:
{
   "cluster":"local",
   "offset":0,
   "timestamp":1585835138740,
   "stream":"applicationlogevents",
   "partition":5
}For more detailed information, please refer Rest-Proxy Produce Service
Next Step: Consuming data via REST
In the next step you will consume data via the REST Proxy.
Proceed to Consuming Data (REST)