1

I'm trying to create an EventRelation using the REST API, but it does not seem to be working. Here are the details of the request:

URI: /services/data/v37.0/sobjects/EventRelation/

With the following in the body of the request:

EventId: xxx (ID of the event I want to add a relation to)

RelationId: xxx (ID of a specific contact)

The API doesn't create the EventRelation and just returns the following:

{
  "objectDescribe": {
    "activateable": false,
    "createable": true,
    "custom": false,
    "customSetting": false,
    "deletable": true,
    "deprecatedAndHidden": false,
    "feedEnabled": false,
    "keyPrefix": "0RE",
    "label": "Event Relation",
    "labelPlural": "Event Relations",
    "layoutable": false,
    "mergeable": false,
    "mruEnabled": false,
    "name": "EventRelation",
    "queryable": true,
    "replicateable": true,
    "retrieveable": true,
    "searchable": false,
    "triggerable": false,
    "undeletable": false,
    "updateable": true,
    "urls": {
      "rowTemplate": "/services/data/v37.0/sobjects/EventRelation/{ID}",
      "defaultValues": "/services/data/v37.0/sobjects/EventRelation/defaultValues?recordTypeId&fields",
      "describe": "/services/data/v37.0/sobjects/EventRelation/describe",
      "sobject": "/services/data/v37.0/sobjects/EventRelation"
    }
  },
  "recentItems": [
  ]
}

Is there something I'm doing wrong? Am I not passing required fields? I simply just want to attach a lead or contact to an event.

  • Are you setting the method as POST instead of GET? – Adrian Larson Jun 29 '17 at 15:51
1

Sounds to me like you just specified GET instead of POST as the method. That returns the describe, instead of trying to create a record. Make sure you set your method to POST.


POST

Notice how the API is clearly trying to create a record here:

POST Results


GET

Here, the API returns the describe:

GET Results

  • Ah this makes so much sense thanks! I'm now getting the error "The HTTP entity body is required, but this request has no entity body." which is strange because I am passing the EventId and RelationId in the body, any thoughts? – Chris Schlitt Jun 29 '17 at 16:03
  • @ChrisSchlitt I would create a new question for that and share the actual code you use to make the callout. – Adrian Larson Jun 29 '17 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.