function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michal Bajdek 13Michal Bajdek 13 

platform event via post request

Hello, I am trying to create new Platform Event using REST call. I have found an trailhead with “Spotted Bear” application, and it works on my dev environment (I also have own domain and connected app). Then I use following endpoint:

I get following response:
    "id": "",
    "asserted_user": true,
    "user_id": "test",
    "organization_id": "test",
    "username": "",
    "nick_name": "email",
    "display_name": "Michal Surname",
    "email": "",
    "email_verified": true,
    "first_name": "Michal",
    "last_name": "Surname",
    "timezone": "Europe/Dublin",
    "photos": {
        "picture": "",
        "thumbnail": ""
    "addr_street": null,
    "addr_city": null,
    "addr_state": null,
    "addr_country": "PL",
    "addr_zip": null,
    "mobile_phone": null,
    "mobile_phone_verified": false,
    "is_lightning_login_user": false,
    "status": {
        "created_date": null,
        "body": null
    "urls": {
        "enterprise": "{version}/id",
        "metadata": "{version}/id",
        "partner": "{version}/id",
        "rest": "{version}/",
        "sobjects": "{version}/sobjects/",
        "search": "{version}/search/",
        "query": "{version}/query/",
        "recent": "{version}/recent/",
        "tooling_soap": "{version}/id",
        "tooling_rest": "{version}/tooling/",
        "profile": "",
        "feeds": "{version}/chatter/feeds",
        "groups": "{version}/chatter/groups",
        "users": "{version}/chatter/users",
        "feed_items": "{version}/chatter/feed-items",
        "feed_elements": "{version}/chatter/feed-elements",
        "custom_domain": ""
    "active": true,
    "user_type": "STANDARD",
    "language": "en_US",
    "locale": "en_IE_EURO",
    "utcOffset": 0,
    "last_modified_date": "2017-09-18T13:46:11.000+0000",
    "is_app_installed": true

As a response I get many fields, but I need only “id” and “rest” , but when I am trying to create new platform event via url: /sobjects/Notification__e/
As a response I get only:
        "message": "Session expired or invalid",
        "errorCode": "INVALID_SESSION_ID"

I do not know what to do since there is no information about session_id:
Hi Michal - did you resolve this? I am finding the same problem when trying to post to a PE from outside SF.