cancel
Showing results for 
Search instead for 
Did you mean: 

Jam OData API Find External Objects by External ID

Former Member
0 Kudos

Dear community,

we are currently working with the SAP Jam OData API and creating groups in SAP Jam with a primary ExternalObject attached.

I've already noticed the GET-Call of ExternalObjects_FindByExidAndObjectType, but I am unsure of how the parameters (both Exid and ObjectType) should be set. After sending the url-encoded request I get the error 'Invalid OAuth protected resource access request. OAuth authentication failed.', which is definitely not an authentication failure, since other request work as expected.

Therefore my question: Is there a possibility to retrieve the internal Jam id of an ExternalObject by using the SAP Jam OData API?

Thanks for your help in advance!

Best regards, Christine

Accepted Solutions (1)

Accepted Solutions (1)

Adam_Stone
Active Contributor
0 Kudos

Hi Christine,

This is the method that you should be using.  An example of this call looks like:
[GET] /ExternalObjects_FindByExidAndObjectType?Exid='https://espmrefapps.hana.ondemand.com:443/espm-cloud-web/espm.svc/Products(''AD-1000')'&ObjectType='...'


You should only be getting an authentication error if you are actually having an issue authenticating.  Is it possible that you are not passing the authentication correctly in this call?  Additionally, does the user you are using in the API have access to this external object?


One other thing to note, if this object has never been created before, either through the API or by browsing the Business Records in the Jam UI, this will not be able to find the object.

You may just want to create the External Object when creating the group with a JSON like this:

{                                                               

"Name" : "MyGroupName-0807a",                                                               

"Template" : {                                                                               

"__metadata" : {                                                                                               

"uri" : "https://developer.sapjam.com/api/v1/OData/GroupTemplates(Id='" + templateId + "',GroupTemplateType='custom')"                                                                                }                                                                },                                                                "PrimaryExternalObject" : {                                                                              

"__metadata" : {                                                                                              

"uri" : "Groups('0')/PrimaryExternalObject",                                                                                               

"type": "SAPJam.ExternalObject"                                                                               

},                                                                               

"Exid":"SomeIdDoesntMatter",                                                                               

"Name":"Opportunity 12345",                                                                                "Permalink":"https://abc.company.com/sap/opportunities/xyz789.html",                                                                                    "ODataAnnotations":"http://www.sap.com/odata/annotations/crm/opportunity.xml",                                                                                    "ODataMetadata":"http://www.sap.com/odata/crm/$metadata#schema.entity-container/Opportunities",                                                                               

"ODataLink":"http://www.sap.com/odata/crm/Opportunities(xyz789)",                                                                                    "ObjectType":"http://www.sap.com/sap/opu/odata/CRMSWI01/SWIGW_BT_OPP_NOTIF_SRV/$metadata#OpportunityCollection"                                                              

}                                              

}

Former Member
0 Kudos

Dear Adam,

thank you for your help!

We solved the issue. The problem was that inside the Exid value we had to escape single quotes with two single quotes.

Now it works!

Kind regrads,

Christine

Former Member
0 Kudos

Dear Adam,

we face another problem now. We want to create a group of at least three employees which are responsible for a customer, whose business record should be set as primary external object within this group so that the customers data (contact persons, employees, projects ...) is directly attached and usable in the group. As you said that the business object won't be found if it wasn't created before, is there a possibility to automatically generate all business objects within Jam, since clicking on each item is not very appealing as there may be hundreds of customers.

Thanks in advance and best regards,

Jürgen

Adam_Stone
Active Contributor
0 Kudos

Hi Jurgen,

As per my earlier response, you would just create the External Object with the json that I provided.

Thanks,
Adam

Answers (0)