Publishing an Official Event to an Event Channel
Function
This API is used to publish an official event to an event channel.
URI
POST /v1/{project_id}/official/sources/{source_name}/events
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Tenant project ID. |
source_name |
Yes |
String |
Name of the event source. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. Minimum: 1 Maximum: 16384 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
events |
No |
Array of CloudEvents objects |
CloudEvents event format definition. For details, see https://github.com/cloudevents/spec/blob/v1.0.1/spec.md. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
id |
Yes |
String |
Event ID. The ID must be unique for the same event source. |
source |
Yes |
String |
Event source. The combination of source and id uniquely identifies an event. The URI-Reference format is used. For details, see https://tools.ietf.org/html/rfc3986#section-4.1. |
specversion |
Yes |
String |
CloudEvents protocol version. The format is major.minor. |
type |
Yes |
String |
Event type. |
datacontenttype |
No |
String |
Event content format. Events use the MIME format and comply with RFC 2046. For details, see https://tools.ietf.org/html/rfc2046. |
dataschema |
No |
String |
URI defined by the event content schema, which complies with RFC 3986. For details, see https://tools.ietf.org/html/rfc3986#section-4.3. |
data |
No |
Object |
Event payload content, which uses the format specified by the datacontenttype field. The content field complies with the description of the dataschema field. |
time |
No |
String |
UTC time when the event occurs. Events from the same source have the same format, which complies with RFC 3339. An example format is 2018-04-05T17:31:00Z. For details, see https://tools.ietf.org/html/rfc3339. |
subject |
No |
String |
Subject or object where the event occurs. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
X-Request-Id |
String |
This field is the request ID number for task tracking. Format is request_uuid-timestamp-hostname. |
Parameter |
Type |
Description |
---|---|---|
failed_count |
Integer |
Number of events that fail to be published. |
events |
Array of events objects |
Event list. |
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code displayed for the publishing failure. |
error_msg |
String |
Cause of the publishing failure. |
event_id |
String |
Unique ID of the event. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. Minimum: 1 Maximum: 128 |
error_msg |
String |
Error message. Minimum: 1 Maximum: 512 |
error_details |
String |
Error details. Minimum: 1 Maximum: 1024 |
request_id |
String |
Request ID. Minimum: 1 Maximum: 128 |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. Minimum: 1 Maximum: 128 |
error_msg |
String |
Error message. Minimum: 1 Maximum: 512 |
error_details |
String |
Error details. Minimum: 1 Maximum: 1024 |
request_id |
String |
Request ID. Minimum: 1 Maximum: 128 |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. Minimum: 1 Maximum: 128 |
error_msg |
String |
Error message. Minimum: 1 Maximum: 512 |
error_details |
String |
Error details. Minimum: 1 Maximum: 1024 |
request_id |
String |
Request ID. Minimum: 1 Maximum: 128 |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. Minimum: 1 Maximum: 128 |
error_msg |
String |
Error message. Minimum: 1 Maximum: 512 |
error_details |
String |
Error details. Minimum: 1 Maximum: 1024 |
request_id |
String |
Request ID. Minimum: 1 Maximum: 128 |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. Minimum: 1 Maximum: 128 |
error_msg |
String |
Error message. Minimum: 1 Maximum: 512 |
error_details |
String |
Error details. Minimum: 1 Maximum: 1024 |
request_id |
String |
Request ID. Minimum: 1 Maximum: 128 |
Example Requests
None
Example Responses
Status code: 400
{ "error_code" : "EG.00014000", "error_msg" : "Bad request" }
Status code: 401
{ "error_code" : "EG.00014010", "error_msg" : "Incorrect token or token resolution failed" }
Status code: 403
{ "error_code" : "EG.00014030", "error_msg" : "No permissions to request this method" }
Status code: 404
{ "error_code" : "EG.00014040", "error_msg" : "Not request resource found" }
Status code: 500
{ "error_code" : "EG.00015000", "error_msg" : "Internal Server Error" }
Status Codes
Status Code |
Description |
---|---|
200 |
Information |
400 |
Invalid request. |
401 |
Unauthorized. |
403 |
Access denied. |
404 |
Resource not found. |
500 |
Internal service error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.