cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to pass multiple IDs in a GET call?

ShivaniParihar
Participant
0 Likes
1,778

Hello Team,

I'm using this query to get Additional IDs based on email address -

/sap/opu/odata/SAP/API_MKT_CONTACT_SRV;v=3/AdditionalIDs?$filter=InteractionContactAdditionalOrigin eq'EMAIL' and InteractionContactAdditionalExternalID eq'retr.rtewe@tryre.xsae','pushukla@in.ibm.com' &$top=200

How we can run this query if we have list of email address (in hundreds/thousands) ? How we can use multiple email IDs in this query? Can we do a batch processing?

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

jayce_wang
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Pushpak,

You can use a batch request like below:

--batch
content-type: application/http
content-transfer-encoding: binary

GET AdditionalIDs?$filter=InteractionContactAdditionalOrigin%20eq%20%27EMAIL%27and%20InteractionContactAdditionalExternalID%20eq%20%27test1@test.com%27&$top=200 HTTP/1.1
Accept: application/json Sap-Cuan-RequestTimestamp: '2019-07-01T13:04:46.002' Sap-Cuan-SourceSystemType: EXT Sap-Cuan-SourceSystemId: C4C sap-cuan-referenceid: REQ1 Content-Type: application/json Content-Length: 1021 content-type: application/http content-transfer-encoding: binary GET AdditionalIDs?$filter=InteractionContactAdditionalOrigin%20eq%20%27EMAIL%27and%20InteractionContactAdditionalExternalID%20eq%20%27test2@test.com%27&$top=200 HTTP/1.1 Accept: application/json Sap-Cuan-RequestTimestamp: '2019-07-01T13:04:46.002' Sap-Cuan-SourceSystemType: EXT Sap-Cuan-SourceSystemId: C4C sap-cuan-referenceid: REQ1 Content-Type: application/json Content-Length: 1021 --batch--

I tested it within internal system and response looks good.

Best regards,

Jayce

ShivaniParihar
Participant
0 Likes

Hello jayce.wang

Thank you for confirmation. I tried using your example payload as below -

--batch
content-type: application/http
content-transfer-encoding: binary

GET AdditionalIDs?$filter=InteractionContactAdditionalOrigin%20eq%20%27EMAIL%27and%20InteractionContactAdditionalExternalID%20eq%20%27test_api2@gmail.com%27&$top=5000 HTTP/1.1Content-Type: application/json

Accept: application/json
Sap-Cuan-RequestTimestamp: '2019-07-01T13:04:46.002'
Sap-Cuan-SourceSystemType: EXT
Sap-Cuan-SourceSystemId: C4C
sap-cuan-referenceid: REQ1
Content-Length: 900000


content-type: application/http
content-transfer-encoding: binary

GET AdditionalIDs?$filter=InteractionContactAdditionalOrigin%20eq%20%27EMAIL%27and%20InteractionContactAdditionalExternalID%20eq%20%27test_api1@gmail.com%27&$top=5000 HTTP/1.1Content-Type: application/json

Accept: application/json
Sap-Cuan-RequestTimestamp: '2019-07-01T13:04:46.002'
Sap-Cuan-SourceSystemType: EXT
Sap-Cuan-SourceSystemId: C4C
sap-cuan-referenceid: REQ1
Content-Length: 900000



--batch--

and below is its response body -

--46086849EA561BF8CBDEDE487C813AAA0
Content-Type: application/http
Content-Length: 2685
content-transfer-encoding: binary

HTTP/1.1 200 OK
Content-Type: application/atom+xml;type=feed
Content-Length: 2479
dataserviceversion: 2.0
sap-metadata-last-modified: Mon, 28 Feb 2022 13:38:04 GMT
cache-control: no-store, no-cache

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="http://brosapmd1.brotherdc01.eu:8020/sap/opu/odata/sap/API_MKT_CONTACT_SRV;v=3/">
<id>http://brosapmd1.brotherdc01.eu:8020/sap/opu/odata/sap/API_MKT_CONTACT_SRV;v=3/AdditionalIDs</id>
<title type="text">AdditionalIDs</title>
<updated>2022-03-11T15:23:43Z</updated>
<author>
<name/>
</author>
<link href="AdditionalIDs" rel="self" title="AdditionalIDs"/>
<entry>
<id>http://brosapmd1.brotherdc01.eu:8020/sap/opu/odata/sap/API_MKT_CONTACT_SRV;v=3/AdditionalIDs(ContactOrigin='SAP_C4C_BUPA',ContactID='7500058727',InteractionContactAdditionalOrigin='EMAIL',InteractionContactAdditionalExternalID='test_api2%40gmail.com')</id>
<title type="text">AdditionalIDs(ContactOrigin='SAP_C4C_BUPA',ContactID='7500058727',InteractionContactAdditionalOrigin='EMAIL',InteractionContactAdditionalExternalID='test_api2%40gmail.com')</title>
<updated>2022-03-11T15:23:43Z</updated>
<category term="API_MKT_CONTACT_SRV.AdditionalID" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
<link href="AdditionalIDs(ContactOrigin='SAP_C4C_BUPA',ContactID='7500058727',InteractionContactAdditionalOrigin='EMAIL',InteractionContactAdditionalExternalID='test_api2%40gmail.com')" rel="edit" title="AdditionalID"/>
<link href="AdditionalIDs(ContactOrigin='SAP_C4C_BUPA',ContactID='7500058727',InteractionContactAdditionalOrigin='EMAIL',InteractionContactAdditionalExternalID='test_api2%40gmail.com')/MarketingAreas" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/MarketingAreas" type="application/atom+xml;type=feed" title="MarketingAreas"/>
<content type="application/xml">
<m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<d:ContactOrigin>SAP_C4C_BUPA</d:ContactOrigin>
<d:ContactID>7500058727</d:ContactID>
<d:InteractionContactAdditionalOrigin>EMAIL</d:InteractionContactAdditionalOrigin>
<d:InteractionContactAdditionalExternalID>test_api2@gmail.com</d:InteractionContactAdditionalExternalID>
<d:InteractionContactAdditionalOriginUUID>5065f388-2fd2-1eec-a6dc-9a95e6d1e6c3</d:InteractionContactAdditionalOriginUUID>
<d:ContactUUID>5065f388-2fd2-1eec-a6dc-9a95e6d1a6c3</d:ContactUUID>
<d:IntactnContactAddlIDIsInvalid>false</d:IntactnContactAddlIDIsInvalid>
</m:properties>
</content>
</entry>
</feed>
--46086849EA561BF8CBDEDE487C813AAA0--

As you can see, only for the first GET query there is a response but not for the second one. Can you please check and let me know how to get the response with both the queries' responses and not only the first one.

Regards,
Pushpak

jayce_wang
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Pushpak,

As I have answered in the incident, please use following sample payload instead.

--batch
content-type: application/http
content-transfer-encoding: binary
GET AdditionalIDs?$filter=InteractionContactAdditionalOrigin%20eq%20%27EMAIL%27and%20InteractionContactAdditionalExternalID%20eq%20%27test_api2@gmail.com%27&$top=200 HTTP/1.1
Accept: application/json
Sap-Cuan-RequestTimestamp: '2019-07-01T13:04:46.002'
Sap-Cuan-SourceSystemType: EXT
Sap-Cuan-SourceSystemId: C4C
sap-cuan-referenceid: REQ1
Content-Type: application/json
Content-Length: 1021

--batch
content-type: application/http
content-transfer-encoding: binary
GET AdditionalIDs?$filter=InteractionContactAdditionalOrigin%20eq%20%27EMAIL%27and%20InteractionContactAdditionalExternalID%20eq%20%27test_api1@gmail.com%27&$top=200 HTTP/1.1
Accept: application/json
Sap-Cuan-RequestTimestamp: '2019-07-01T13:04:46.002'
Sap-Cuan-SourceSystemType: EXT
Sap-Cuan-SourceSystemId: C4C
sap-cuan-referenceid: REQ1
Content-Type: application/json
Content-Length: 1021

--batch--

Best regards,

Jayce