Newer Version Available

This content describes an older version of this product. View Latest

Platform Event Schema by Event Name

Gets the definition of a platform event in JSON format for a given event name.

Syntax

URI
/vXX.X/sobjects/Platform_Event_Name__e/eventSchema
Available since release
40.0
Formats
JSON
HTTP methods
GET
Authentication
Authorization: Bearer token

Example

This URI gets the schema of a platform event named Low_Ink__e.

1/services/data/v40.0/sobjects/Low_Ink__e/eventSchema

The returned response looks like the following.

1{
2  "name" : "Low_Ink__e",
3  "namespace" : "com.salesforce.event.org00DD00000008Xay",
4  "type" : "record",
5  "fields" : [ {
6    "name" : "CreatedDate",
7    "type" : "string"
8  }, {
9    "name" : "CreatedById",
10    "type" : "string"
11  }, {
12    "name" : "Printer_Model__c",
13    "type" : [ "null", "string" ],
14    "default" : null
15  }, {
16    "name" : "Serial_Number__c",
17    "type" : [ "null", "string" ],
18    "default" : null
19  }, {
20    "name" : "Ink_Percentage__c",
21    "type" : [ "null", "double" ],
22    "default" : null
23  } ],
24  "uuid" : "dffQ2QLzDNHqwB8_sHMxdA"
25}
The fields in the returned response adhere to the open-source Apache Avro specification for the record complex type (see Avro Records in the Apache Avro specification). Note the following:
  • name is the name of the platform event.
  • namespace qualifies the event name and is in the format com.salesforce.event.{orgId}.
  • type is the Avro complex type.
  • fields is a JSON array containing the fields of the platform event. For each field, type indicates that the field can be either null or have a value of the specified type. Also, default is a default value for the field when the field is not present.

The response contains one more field, uuid, which contains the ID of this schema. The ID is the MD5 fingerprint of the normalized Avro schema, encoded as a base-64 URL variant. You can append this ID to the /vXX.X/event/eventSchema/ URI to retrieve the schema.

The ReplayId standard field isn’t returned in the schema because the system generates it after events are published.

If you change the definition of a platform event, the schema ID for this platfom event changes.

Note