SQL Server / Creatio API / $filter parameter (eq operator) with Id
Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
DECLARE @queryParams int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @queryParams OUT
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, '$filter', 'Collection6/Field6 eq Id'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'ForceUseSession', 'true'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'BPMCSRF', '{{BPMCSRF}}'
DECLARE @resp int
EXEC sp_OAMethod @http, 'QuickRequestParams', @resp OUT, 'GET', 'https://myserver.com/0/odata/Collection3', @queryParams
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
RETURN
END
DECLARE @sbResponseBody int
-- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT
EXEC sp_OAMethod @resp, 'GetBodySb', @success OUT, @sbResponseBody
DECLARE @jResp int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jResp OUT
EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
EXEC sp_OASetProperty @jResp, 'EmitCompact', 0
PRINT 'Response Body:'
EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
PRINT @sTmp0
DECLARE @respStatusCode int
EXEC sp_OAGetProperty @resp, 'StatusCode', @respStatusCode OUT
PRINT 'Response Status Code = ' + @respStatusCode
IF @respStatusCode >= 400
BEGIN
PRINT 'Response Header:'
EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Failed.'
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
RETURN
END
EXEC @hr = sp_OADestroy @resp
-- Sample JSON response:
-- (Sample code for parsing the JSON response is shown below)
-- {
-- "@odata.context": "https://myserver.com/0/odata/$metadata#Contact",
-- "value": [
-- {
-- "Id": "7aec3929-5d18-4086-ad7c-0fd9315e637a",
-- "Name": "Lynn A. Collins",
-- "OwnerId": "410006e1-ca4e-4502-a9ec-e54d922d2c00",
-- "CreatedOn": "2019-12-01T13:52:24Z",
-- "CreatedById": "76929f8c-7e15-4c64-bdb0-adc62d383727",
-- "ModifiedOn": "2016-09-05T10:08:22Z",
-- "ModifiedById": "76929f8c-7e15-4c64-bdb0-adc62d383727",
-- "ProcessListeners": 0,
-- "Dear": "",
-- "SalutationTypeId": "f4b32ee6-f36b-1410-aa84-00155d043204",
-- "GenderId": "00000000-0000-0000-0000-000000000000",
-- "AccountId": "00000000-0000-0000-0000-000000000000",
-- "DecisionRoleId": "00000000-0000-0000-0000-000000000000",
-- "TypeId": "806732ee-f36b-1410-a883-16d83cab0980",
-- "JobId": "00000000-0000-0000-0000-000000000000",
-- "JobTitle": "",
-- "DepartmentId": "00000000-0000-0000-0000-000000000000",
-- "BirthDate": "1991-03-20T00:00:00Z",
-- "Phone": "",
-- "MobilePhone": "",
-- "HomePhone": "",
-- "Skype": "",
-- "Email": "",
-- "AddressTypeId": "00000000-0000-0000-0000-000000000000",
-- "Address": "",
-- "CityId": "00000000-0000-0000-0000-000000000000",
-- "RegionId": "00000000-0000-0000-0000-000000000000",
-- "Zip": "",
-- "CountryId": "00000000-0000-0000-0000-000000000000",
-- "DoNotUseEmail": true,
-- "DoNotUseCall": true,
-- "DoNotUseFax": true,
-- "DoNotUseSms": true,
-- "DoNotUseMail": true,
-- "Notes": "",
-- "Facebook": "",
-- "LinkedIn": "",
-- "Twitter": "",
-- "FacebookId": "",
-- "LinkedInId": "",
-- "TwitterId": "",
-- "ContactPhoto@odata.mediaEditLink": "Contact(7aec3929-5d18-4086-ad7c-0fd9315e637a)/ContactPhoto",
-- "ContactPhoto@odata.mediaReadLink": "Contact(7aec3929-5d18-4086-ad7c-0fd9315e637a)/ContactPhoto",
-- "ContactPhoto@odata.mediaContentType": "application/octet-stream",
-- "TwitterAFDAId": "00000000-0000-0000-0000-000000000000",
-- "FacebookAFDAId": "00000000-0000-0000-0000-000000000000",
-- "LinkedInAFDAId": "00000000-0000-0000-0000-000000000000",
-- "PhotoId": "00000000-0000-0000-0000-000000000000",
-- "GPSN": "",
-- "GPSE": "",
-- "Surname": "",
-- "GivenName": "",
-- "MiddleName": "",
-- "Confirmed": false,
-- "IsNonActualEmail": false,
-- "Completeness": 15,
-- "LanguageId": "00000000-0000-0000-0000-000000000000",
-- "Age": 29
-- },
-- {
-- "Id": "bb843dd1-3802-424c-9c02-489702de9f1d",
-- "Name": "Administrator",
-- "OwnerId": "410006e1-ca4e-4502-a9ec-e54d922d2c00",
-- "CreatedOn": "2020-07-14T02:14:20.806177Z",
-- "CreatedById": "00000000-0000-0000-0000-000000000000",
-- "ModifiedOn": "2020-07-14T02:14:20.806177Z",
-- "ModifiedById": "00000000-0000-0000-0000-000000000000",
-- "ProcessListeners": 0,
-- "Dear": "",
-- "SalutationTypeId": "00000000-0000-0000-0000-000000000000",
-- "GenderId": "00000000-0000-0000-0000-000000000000",
-- "AccountId": "e308b781-3c5b-4ecb-89ef-5c1ed4da488e",
-- "DecisionRoleId": "00000000-0000-0000-0000-000000000000",
-- "TypeId": "60733efc-f36b-1410-a883-16d83cab0980",
-- "JobId": "00000000-0000-0000-0000-000000000000",
-- "JobTitle": "",
-- "DepartmentId": "00000000-0000-0000-0000-000000000000",
-- "BirthDate": "0001-01-01T00:00:00Z",
-- "Phone": "",
-- "MobilePhone": "",
-- "HomePhone": "",
-- "Skype": "",
-- "Email": "",
-- "AddressTypeId": "00000000-0000-0000-0000-000000000000",
-- "Address": "",
-- "CityId": "00000000-0000-0000-0000-000000000000",
-- "RegionId": "00000000-0000-0000-0000-000000000000",
-- "Zip": "",
-- "CountryId": "00000000-0000-0000-0000-000000000000",
-- "DoNotUseEmail": false,
-- "DoNotUseCall": false,
-- "DoNotUseFax": false,
-- "DoNotUseSms": false,
-- "DoNotUseMail": false,
-- "Notes": "",
-- "Facebook": "",
-- "LinkedIn": "",
-- "Twitter": "",
-- "FacebookId": "",
-- "LinkedInId": "",
-- "TwitterId": "",
-- "ContactPhoto@odata.mediaEditLink": "Contact(bb843dd1-3802-424c-9c02-489702de9f1d)/ContactPhoto",
-- "ContactPhoto@odata.mediaReadLink": "Contact(bb843dd1-3802-424c-9c02-489702de9f1d)/ContactPhoto",
-- "ContactPhoto@odata.mediaContentType": "application/octet-stream",
-- "TwitterAFDAId": "00000000-0000-0000-0000-000000000000",
-- "FacebookAFDAId": "00000000-0000-0000-0000-000000000000",
-- "LinkedInAFDAId": "00000000-0000-0000-0000-000000000000",
-- "PhotoId": "00000000-0000-0000-0000-000000000000",
-- "GPSN": "",
-- "GPSE": "",
-- "Surname": "",
-- "GivenName": "",
-- "MiddleName": "",
-- "Confirmed": false,
-- "IsNonActualEmail": false,
-- "Completeness": 0,
-- "LanguageId": "00000000-0000-0000-0000-000000000000",
-- "Age": 0
-- },
-- {
-- "Id": "c4ed336c-3e9b-40fe-8b82-5632476472b4",
-- "Name": "Andrew Baker (sample)",
-- "OwnerId": "410006e1-ca4e-4502-a9ec-e54d922d2c00",
-- "CreatedOn": "2018-06-04T12:13:18Z",
-- "CreatedById": "410006e1-ca4e-4502-a9ec-e54d922d2c00",
-- "ModifiedOn": "2016-09-15T14:27:21Z",
-- "ModifiedById": "410006e1-ca4e-4502-a9ec-e54d922d2c00",
-- "ProcessListeners": 0,
-- "Dear": "",
-- "SalutationTypeId": "7426ffb3-56e6-df11-971b-001d60e938c6",
-- "GenderId": "eeac42ee-65b6-df11-831a-001d60e938c6",
-- "AccountId": "405947d0-2ffb-4ded-8675-0475f19f5a81",
-- "DecisionRoleId": "f71ee81d-0cac-4e41-b7dc-9d4bd2e08491",
-- "TypeId": "00783ef6-f36b-1410-a883-16d83cab0980",
-- "JobId": "cb49a603-57e6-df11-971b-001d60e938c6",
-- "JobTitle": "Specialist",
-- "DepartmentId": "2076c4b6-7fe6-df11-971b-001d60e938c6",
-- "BirthDate": "1986-06-05T00:00:00Z",
-- "Phone": "+1 617 440 2031",
-- "MobilePhone": "+1 617 221 5187",
-- "HomePhone": "",
-- "Skype": "",
-- "Email": "a.baker@ac.com",
-- "AddressTypeId": "4f8b2d67-71d0-45fb-897e-cd4a308a97c0",
-- "Address": "39 Columbia Street",
-- "CityId": "74144617-a288-4984-bcac-e78733277a61",
-- "RegionId": "658acfe7-09ae-4747-b1b3-541e2dfa1b9e",
-- "Zip": "02112",
-- "CountryId": "e0be1264-f36b-1410-fa98-00155d043204",
-- "DoNotUseEmail": false,
-- "DoNotUseCall": false,
-- "DoNotUseFax": false,
-- "DoNotUseSms": false,
-- "DoNotUseMail": false,
-- "Notes": "",
-- "Facebook": "",
-- "LinkedIn": "",
-- "Twitter": "",
-- "FacebookId": "",
-- "LinkedInId": "",
-- "TwitterId": "",
-- "ContactPhoto@odata.mediaEditLink": "Contact(c4ed336c-3e9b-40fe-8b82-5632476472b4)/ContactPhoto",
-- "ContactPhoto@odata.mediaReadLink": "Contact(c4ed336c-3e9b-40fe-8b82-5632476472b4)/ContactPhoto",
-- "ContactPhoto@odata.mediaContentType": "application/octet-stream",
-- "TwitterAFDAId": "00000000-0000-0000-0000-000000000000",
-- "FacebookAFDAId": "00000000-0000-0000-0000-000000000000",
-- "LinkedInAFDAId": "00000000-0000-0000-0000-000000000000",
-- "PhotoId": "00000000-0000-0000-0000-000000000000",
-- "GPSN": "",
-- "GPSE": "",
-- "Surname": "Baker",
-- "GivenName": "Andrew",
-- "MiddleName": "",
-- "Confirmed": true,
-- "IsNonActualEmail": false,
-- "Completeness": 30,
-- "LanguageId": "00000000-0000-0000-0000-000000000000",
-- "Age": 34
-- },
-- {
-- "Id": "9c2d2822-fc35-4ed5-a131-2f08bd4ab9f7",
-- "Name": "Mary King",
-- "OwnerId": "410006e1-ca4e-4502-a9ec-e54d922d2c00",
-- "CreatedOn": "2020-02-04T12:43:53Z",
-- "CreatedById": "76929f8c-7e15-4c64-bdb0-adc62d383727",
-- "ModifiedOn": "2016-09-05T10:08:22Z",
-- "ModifiedById": "76929f8c-7e15-4c64-bdb0-adc62d383727",
-- "ProcessListeners": 0,
-- "Dear": "King",
-- "SalutationTypeId": "f4b32ee6-f36b-1410-aa84-00155d043204",
-- "GenderId": "eeac42ee-65b6-df11-831a-001d60e938c6",
-- "AccountId": "e308b781-3c5b-4ecb-89ef-5c1ed4da488e",
-- "DecisionRoleId": "00000000-0000-0000-0000-000000000000",
-- "TypeId": "60733efc-f36b-1410-a883-16d83cab0980",
-- "JobId": "955472f0-56e6-df11-971b-001d60e938c6",
-- "JobTitle": "",
-- "DepartmentId": "2076c4b6-7fe6-df11-971b-001d60e938c6",
-- "BirthDate": "1981-09-05T00:00:00Z",
-- "Phone": "3020",
-- "MobilePhone": "",
-- "HomePhone": "",
-- "Skype": "",
-- "Email": "",
-- "AddressTypeId": "4f8b2d67-71d0-45fb-897e-cd4a308a97c0",
-- "Address": "73 Carson Road",
-- "CityId": "a1bf2e42-f36b-1410-0499-00155d043204",
-- "RegionId": "b1ae2e80-f36b-1410-3899-00155d043204",
-- "Zip": "",
-- "CountryId": "96ae123c-f46b-1410-f998-00155d043204",
-- "DoNotUseEmail": true,
-- "DoNotUseCall": true,
-- "DoNotUseFax": true,
-- "DoNotUseSms": true,
-- "DoNotUseMail": true,
-- "Notes": "",
-- "Facebook": "",
-- "LinkedIn": "",
-- "Twitter": "",
-- "FacebookId": "",
-- "LinkedInId": "",
-- "TwitterId": "",
-- "ContactPhoto@odata.mediaEditLink": "Contact(9c2d2822-fc35-4ed5-a131-2f08bd4ab9f7)/ContactPhoto",
-- "ContactPhoto@odata.mediaReadLink": "Contact(9c2d2822-fc35-4ed5-a131-2f08bd4ab9f7)/ContactPhoto",
-- "ContactPhoto@odata.mediaContentType": "application/octet-stream",
-- "TwitterAFDAId": "00000000-0000-0000-0000-000000000000",
-- "FacebookAFDAId": "00000000-0000-0000-0000-000000000000",
-- "LinkedInAFDAId": "00000000-0000-0000-0000-000000000000",
-- "PhotoId": "00000000-0000-0000-0000-000000000000",
-- "GPSN": "",
-- "GPSE": "",
-- "Surname": "",
-- "GivenName": "",
-- "MiddleName": "",
-- "Confirmed": false,
-- "IsNonActualEmail": false,
-- "Completeness": 30,
-- "LanguageId": "00000000-0000-0000-0000-000000000000",
-- "Age": 39
-- }
-- ]
-- }
-- Sample code for parsing the JSON response...
-- Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
DECLARE @Id nvarchar(4000)
DECLARE @Name nvarchar(4000)
DECLARE @OwnerId nvarchar(4000)
DECLARE @CreatedOn nvarchar(4000)
DECLARE @CreatedById nvarchar(4000)
DECLARE @ModifiedOn nvarchar(4000)
DECLARE @ModifiedById nvarchar(4000)
DECLARE @ProcessListeners int
DECLARE @Dear nvarchar(4000)
DECLARE @SalutationTypeId nvarchar(4000)
DECLARE @GenderId nvarchar(4000)
DECLARE @AccountId nvarchar(4000)
DECLARE @DecisionRoleId nvarchar(4000)
DECLARE @TypeId nvarchar(4000)
DECLARE @JobId nvarchar(4000)
DECLARE @JobTitle nvarchar(4000)
DECLARE @DepartmentId nvarchar(4000)
DECLARE @BirthDate nvarchar(4000)
DECLARE @Phone nvarchar(4000)
DECLARE @MobilePhone nvarchar(4000)
DECLARE @HomePhone nvarchar(4000)
DECLARE @Skype nvarchar(4000)
DECLARE @v_Email nvarchar(4000)
DECLARE @AddressTypeId nvarchar(4000)
DECLARE @Address nvarchar(4000)
DECLARE @CityId nvarchar(4000)
DECLARE @RegionId nvarchar(4000)
DECLARE @v_Zip nvarchar(4000)
DECLARE @CountryId nvarchar(4000)
DECLARE @DoNotUseEmail int
DECLARE @DoNotUseCall int
DECLARE @DoNotUseFax int
DECLARE @DoNotUseSms int
DECLARE @DoNotUseMail int
DECLARE @Notes nvarchar(4000)
DECLARE @Facebook nvarchar(4000)
DECLARE @LinkedIn nvarchar(4000)
DECLARE @Twitter nvarchar(4000)
DECLARE @FacebookId nvarchar(4000)
DECLARE @LinkedInId nvarchar(4000)
DECLARE @TwitterId nvarchar(4000)
DECLARE @ContactPhotoodata_mediaEditLink nvarchar(4000)
DECLARE @ContactPhotoodata_mediaReadLink nvarchar(4000)
DECLARE @ContactPhotoodata_mediaContentType nvarchar(4000)
DECLARE @TwitterAFDAId nvarchar(4000)
DECLARE @FacebookAFDAId nvarchar(4000)
DECLARE @LinkedInAFDAId nvarchar(4000)
DECLARE @PhotoId nvarchar(4000)
DECLARE @GPSN nvarchar(4000)
DECLARE @GPSE nvarchar(4000)
DECLARE @Surname nvarchar(4000)
DECLARE @GivenName nvarchar(4000)
DECLARE @MiddleName nvarchar(4000)
DECLARE @Confirmed int
DECLARE @IsNonActualEmail int
DECLARE @Completeness int
DECLARE @LanguageId nvarchar(4000)
DECLARE @Age int
DECLARE @odata_context nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @odata_context OUT, '"@odata.context"'
DECLARE @i int
SELECT @i = 0
DECLARE @count_i int
EXEC sp_OAMethod @jResp, 'SizeOfArray', @count_i OUT, 'value'
WHILE @i < @count_i
BEGIN
EXEC sp_OASetProperty @jResp, 'I', @i
EXEC sp_OAMethod @jResp, 'StringOf', @Id OUT, 'value[i].Id'
EXEC sp_OAMethod @jResp, 'StringOf', @Name OUT, 'value[i].Name'
EXEC sp_OAMethod @jResp, 'StringOf', @OwnerId OUT, 'value[i].OwnerId'
EXEC sp_OAMethod @jResp, 'StringOf', @CreatedOn OUT, 'value[i].CreatedOn'
EXEC sp_OAMethod @jResp, 'StringOf', @CreatedById OUT, 'value[i].CreatedById'
EXEC sp_OAMethod @jResp, 'StringOf', @ModifiedOn OUT, 'value[i].ModifiedOn'
EXEC sp_OAMethod @jResp, 'StringOf', @ModifiedById OUT, 'value[i].ModifiedById'
EXEC sp_OAMethod @jResp, 'IntOf', @ProcessListeners OUT, 'value[i].ProcessListeners'
EXEC sp_OAMethod @jResp, 'StringOf', @Dear OUT, 'value[i].Dear'
EXEC sp_OAMethod @jResp, 'StringOf', @SalutationTypeId OUT, 'value[i].SalutationTypeId'
EXEC sp_OAMethod @jResp, 'StringOf', @GenderId OUT, 'value[i].GenderId'
EXEC sp_OAMethod @jResp, 'StringOf', @AccountId OUT, 'value[i].AccountId'
EXEC sp_OAMethod @jResp, 'StringOf', @DecisionRoleId OUT, 'value[i].DecisionRoleId'
EXEC sp_OAMethod @jResp, 'StringOf', @TypeId OUT, 'value[i].TypeId'
EXEC sp_OAMethod @jResp, 'StringOf', @JobId OUT, 'value[i].JobId'
EXEC sp_OAMethod @jResp, 'StringOf', @JobTitle OUT, 'value[i].JobTitle'
EXEC sp_OAMethod @jResp, 'StringOf', @DepartmentId OUT, 'value[i].DepartmentId'
EXEC sp_OAMethod @jResp, 'StringOf', @BirthDate OUT, 'value[i].BirthDate'
EXEC sp_OAMethod @jResp, 'StringOf', @Phone OUT, 'value[i].Phone'
EXEC sp_OAMethod @jResp, 'StringOf', @MobilePhone OUT, 'value[i].MobilePhone'
EXEC sp_OAMethod @jResp, 'StringOf', @HomePhone OUT, 'value[i].HomePhone'
EXEC sp_OAMethod @jResp, 'StringOf', @Skype OUT, 'value[i].Skype'
EXEC sp_OAMethod @jResp, 'StringOf', @v_Email OUT, 'value[i].Email'
EXEC sp_OAMethod @jResp, 'StringOf', @AddressTypeId OUT, 'value[i].AddressTypeId'
EXEC sp_OAMethod @jResp, 'StringOf', @Address OUT, 'value[i].Address'
EXEC sp_OAMethod @jResp, 'StringOf', @CityId OUT, 'value[i].CityId'
EXEC sp_OAMethod @jResp, 'StringOf', @RegionId OUT, 'value[i].RegionId'
EXEC sp_OAMethod @jResp, 'StringOf', @v_Zip OUT, 'value[i].Zip'
EXEC sp_OAMethod @jResp, 'StringOf', @CountryId OUT, 'value[i].CountryId'
EXEC sp_OAMethod @jResp, 'BoolOf', @DoNotUseEmail OUT, 'value[i].DoNotUseEmail'
EXEC sp_OAMethod @jResp, 'BoolOf', @DoNotUseCall OUT, 'value[i].DoNotUseCall'
EXEC sp_OAMethod @jResp, 'BoolOf', @DoNotUseFax OUT, 'value[i].DoNotUseFax'
EXEC sp_OAMethod @jResp, 'BoolOf', @DoNotUseSms OUT, 'value[i].DoNotUseSms'
EXEC sp_OAMethod @jResp, 'BoolOf', @DoNotUseMail OUT, 'value[i].DoNotUseMail'
EXEC sp_OAMethod @jResp, 'StringOf', @Notes OUT, 'value[i].Notes'
EXEC sp_OAMethod @jResp, 'StringOf', @Facebook OUT, 'value[i].Facebook'
EXEC sp_OAMethod @jResp, 'StringOf', @LinkedIn OUT, 'value[i].LinkedIn'
EXEC sp_OAMethod @jResp, 'StringOf', @Twitter OUT, 'value[i].Twitter'
EXEC sp_OAMethod @jResp, 'StringOf', @FacebookId OUT, 'value[i].FacebookId'
EXEC sp_OAMethod @jResp, 'StringOf', @LinkedInId OUT, 'value[i].LinkedInId'
EXEC sp_OAMethod @jResp, 'StringOf', @TwitterId OUT, 'value[i].TwitterId'
EXEC sp_OAMethod @jResp, 'StringOf', @ContactPhotoodata_mediaEditLink OUT, 'value[i]."ContactPhoto@odata.mediaEditLink"'
EXEC sp_OAMethod @jResp, 'StringOf', @ContactPhotoodata_mediaReadLink OUT, 'value[i]."ContactPhoto@odata.mediaReadLink"'
EXEC sp_OAMethod @jResp, 'StringOf', @ContactPhotoodata_mediaContentType OUT, 'value[i]."ContactPhoto@odata.mediaContentType"'
EXEC sp_OAMethod @jResp, 'StringOf', @TwitterAFDAId OUT, 'value[i].TwitterAFDAId'
EXEC sp_OAMethod @jResp, 'StringOf', @FacebookAFDAId OUT, 'value[i].FacebookAFDAId'
EXEC sp_OAMethod @jResp, 'StringOf', @LinkedInAFDAId OUT, 'value[i].LinkedInAFDAId'
EXEC sp_OAMethod @jResp, 'StringOf', @PhotoId OUT, 'value[i].PhotoId'
EXEC sp_OAMethod @jResp, 'StringOf', @GPSN OUT, 'value[i].GPSN'
EXEC sp_OAMethod @jResp, 'StringOf', @GPSE OUT, 'value[i].GPSE'
EXEC sp_OAMethod @jResp, 'StringOf', @Surname OUT, 'value[i].Surname'
EXEC sp_OAMethod @jResp, 'StringOf', @GivenName OUT, 'value[i].GivenName'
EXEC sp_OAMethod @jResp, 'StringOf', @MiddleName OUT, 'value[i].MiddleName'
EXEC sp_OAMethod @jResp, 'BoolOf', @Confirmed OUT, 'value[i].Confirmed'
EXEC sp_OAMethod @jResp, 'BoolOf', @IsNonActualEmail OUT, 'value[i].IsNonActualEmail'
EXEC sp_OAMethod @jResp, 'IntOf', @Completeness OUT, 'value[i].Completeness'
EXEC sp_OAMethod @jResp, 'StringOf', @LanguageId OUT, 'value[i].LanguageId'
EXEC sp_OAMethod @jResp, 'IntOf', @Age OUT, 'value[i].Age'
SELECT @i = @i + 1
END
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
END
GO
Curl Command
curl -G -d "$filter=Collection6%2FField6%20eq%20Id"
-H "ForceUseSession: true"
-H "BPMCSRF: {{BPMCSRF}}"
https://myserver.com/0/odata/Collection3
Postman Collection Item JSON
{
"name": "$filter parameter (eq operator) with Id",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "ForceUseSession",
"type": "text",
"value": "true"
},
{
"key": "BPMCSRF",
"type": "text",
"value": "{{BPMCSRF}}"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{BaseURI}}/0/odata/{{CollectionName3}}?$filter={{CollectionName6}}/{{FieldName6}} eq {{ObjectId6}}",
"host": [
"{{BaseURI}}"
],
"path": [
"0",
"odata",
"{{CollectionName3}}"
],
"query": [
{
"key": "$filter",
"value": "{{CollectionName6}}/{{FieldName6}} eq {{ObjectId6}}"
}
]
},
"description": "Request for getting object collection instances, filtered by Id via the [$filter](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_SystemQueryOptionfilter) parameter with the eq operator."
},
"response": [
{
"name": "[200] Gets filtered object collection instances by Id. The filter uses the “equal” operator",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "ForceUseSession",
"type": "text",
"value": "true"
},
{
"key": "BPMCSRF",
"type": "text",
"value": "{{BPMCSRF}}"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://myserver.com/0/odata/Contact?$filter=Owner/Id eq 410006e1-ca4e-4502-a9ec-e54d922d2c00",
"protocol": "https",
"host": [
"myserver",
"com"
],
"path": [
"0",
"odata",
"Contact"
],
"query": [
{
"key": "$filter",
"value": "Owner/Id eq 410006e1-ca4e-4502-a9ec-e54d922d2c00"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Cache-Control",
"value": "no-cache"
},
{
"key": "Pragma",
"value": "no-cache"
},
{
"key": "Content-Type",
"value": "application/json; odata.metadata=minimal"
},
{
"key": "Expires",
"value": "-1"
},
{
"key": "Server",
"value": "Microsoft-IIS/10.0"
},
{
"key": "OData-Version",
"value": "4.0"
},
{
"key": "X-AspNet-Version",
"value": "4.0.30319"
},
{
"key": "X-Powered-By",
"value": "ASP.NET"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Date",
"value": "Fri, 24 Jul 2020 07:16:54 GMT"
},
{
"key": "Content-Length",
"value": "7783"
}
],
"cookie": [
],
"body": "{\n \"@odata.context\": \"https://myserver.com/0/odata/$metadata#Contact\",\n \"value\": [\n {\n \"Id\": \"7aec3929-5d18-4086-ad7c-0fd9315e637a\",\n \"Name\": \"Lynn A. Collins\",\n \"OwnerId\": \"410006e1-ca4e-4502-a9ec-e54d922d2c00\",\n \"CreatedOn\": \"2019-12-01T13:52:24Z\",\n \"CreatedById\": \"76929f8c-7e15-4c64-bdb0-adc62d383727\",\n \"ModifiedOn\": \"2016-09-05T10:08:22Z\",\n \"ModifiedById\": \"76929f8c-7e15-4c64-bdb0-adc62d383727\",\n \"ProcessListeners\": 0,\n \"Dear\": \"\",\n \"SalutationTypeId\": \"f4b32ee6-f36b-1410-aa84-00155d043204\",\n \"GenderId\": \"00000000-0000-0000-0000-000000000000\",\n \"AccountId\": \"00000000-0000-0000-0000-000000000000\",\n \"DecisionRoleId\": \"00000000-0000-0000-0000-000000000000\",\n \"TypeId\": \"806732ee-f36b-1410-a883-16d83cab0980\",\n \"JobId\": \"00000000-0000-0000-0000-000000000000\",\n \"JobTitle\": \"\",\n \"DepartmentId\": \"00000000-0000-0000-0000-000000000000\",\n \"BirthDate\": \"1991-03-20T00:00:00Z\",\n \"Phone\": \"\",\n \"MobilePhone\": \"\",\n \"HomePhone\": \"\",\n \"Skype\": \"\",\n \"Email\": \"\",\n \"AddressTypeId\": \"00000000-0000-0000-0000-000000000000\",\n \"Address\": \"\",\n \"CityId\": \"00000000-0000-0000-0000-000000000000\",\n \"RegionId\": \"00000000-0000-0000-0000-000000000000\",\n \"Zip\": \"\",\n \"CountryId\": \"00000000-0000-0000-0000-000000000000\",\n \"DoNotUseEmail\": true,\n \"DoNotUseCall\": true,\n \"DoNotUseFax\": true,\n \"DoNotUseSms\": true,\n \"DoNotUseMail\": true,\n \"Notes\": \"\",\n \"Facebook\": \"\",\n \"LinkedIn\": \"\",\n \"Twitter\": \"\",\n \"FacebookId\": \"\",\n \"LinkedInId\": \"\",\n \"TwitterId\": \"\",\n \"ContactPhoto@odata.mediaEditLink\": \"Contact(7aec3929-5d18-4086-ad7c-0fd9315e637a)/ContactPhoto\",\n \"ContactPhoto@odata.mediaReadLink\": \"Contact(7aec3929-5d18-4086-ad7c-0fd9315e637a)/ContactPhoto\",\n \"ContactPhoto@odata.mediaContentType\": \"application/octet-stream\",\n \"TwitterAFDAId\": \"00000000-0000-0000-0000-000000000000\",\n \"FacebookAFDAId\": \"00000000-0000-0000-0000-000000000000\",\n \"LinkedInAFDAId\": \"00000000-0000-0000-0000-000000000000\",\n \"PhotoId\": \"00000000-0000-0000-0000-000000000000\",\n \"GPSN\": \"\",\n \"GPSE\": \"\",\n \"Surname\": \"\",\n \"GivenName\": \"\",\n \"MiddleName\": \"\",\n \"Confirmed\": false,\n \"IsNonActualEmail\": false,\n \"Completeness\": 15,\n \"LanguageId\": \"00000000-0000-0000-0000-000000000000\",\n \"Age\": 29\n },\n {\n \"Id\": \"bb843dd1-3802-424c-9c02-489702de9f1d\",\n \"Name\": \"Administrator\",\n \"OwnerId\": \"410006e1-ca4e-4502-a9ec-e54d922d2c00\",\n \"CreatedOn\": \"2020-07-14T02:14:20.806177Z\",\n \"CreatedById\": \"00000000-0000-0000-0000-000000000000\",\n \"ModifiedOn\": \"2020-07-14T02:14:20.806177Z\",\n \"ModifiedById\": \"00000000-0000-0000-0000-000000000000\",\n \"ProcessListeners\": 0,\n \"Dear\": \"\",\n \"SalutationTypeId\": \"00000000-0000-0000-0000-000000000000\",\n \"GenderId\": \"00000000-0000-0000-0000-000000000000\",\n \"AccountId\": \"e308b781-3c5b-4ecb-89ef-5c1ed4da488e\",\n \"DecisionRoleId\": \"00000000-0000-0000-0000-000000000000\",\n \"TypeId\": \"60733efc-f36b-1410-a883-16d83cab0980\",\n \"JobId\": \"00000000-0000-0000-0000-000000000000\",\n \"JobTitle\": \"\",\n \"DepartmentId\": \"00000000-0000-0000-0000-000000000000\",\n \"BirthDate\": \"0001-01-01T00:00:00Z\",\n \"Phone\": \"\",\n \"MobilePhone\": \"\",\n \"HomePhone\": \"\",\n \"Skype\": \"\",\n \"Email\": \"\",\n \"AddressTypeId\": \"00000000-0000-0000-0000-000000000000\",\n \"Address\": \"\",\n \"CityId\": \"00000000-0000-0000-0000-000000000000\",\n \"RegionId\": \"00000000-0000-0000-0000-000000000000\",\n \"Zip\": \"\",\n \"CountryId\": \"00000000-0000-0000-0000-000000000000\",\n \"DoNotUseEmail\": false,\n \"DoNotUseCall\": false,\n \"DoNotUseFax\": false,\n \"DoNotUseSms\": false,\n \"DoNotUseMail\": false,\n \"Notes\": \"\",\n \"Facebook\": \"\",\n \"LinkedIn\": \"\",\n \"Twitter\": \"\",\n \"FacebookId\": \"\",\n \"LinkedInId\": \"\",\n \"TwitterId\": \"\",\n \"ContactPhoto@odata.mediaEditLink\": \"Contact(bb843dd1-3802-424c-9c02-489702de9f1d)/ContactPhoto\",\n \"ContactPhoto@odata.mediaReadLink\": \"Contact(bb843dd1-3802-424c-9c02-489702de9f1d)/ContactPhoto\",\n \"ContactPhoto@odata.mediaContentType\": \"application/octet-stream\",\n \"TwitterAFDAId\": \"00000000-0000-0000-0000-000000000000\",\n \"FacebookAFDAId\": \"00000000-0000-0000-0000-000000000000\",\n \"LinkedInAFDAId\": \"00000000-0000-0000-0000-000000000000\",\n \"PhotoId\": \"00000000-0000-0000-0000-000000000000\",\n \"GPSN\": \"\",\n \"GPSE\": \"\",\n \"Surname\": \"\",\n \"GivenName\": \"\",\n \"MiddleName\": \"\",\n \"Confirmed\": false,\n \"IsNonActualEmail\": false,\n \"Completeness\": 0,\n \"LanguageId\": \"00000000-0000-0000-0000-000000000000\",\n \"Age\": 0\n },\n {\n \"Id\": \"c4ed336c-3e9b-40fe-8b82-5632476472b4\",\n \"Name\": \"Andrew Baker (sample)\",\n \"OwnerId\": \"410006e1-ca4e-4502-a9ec-e54d922d2c00\",\n \"CreatedOn\": \"2018-06-04T12:13:18Z\",\n \"CreatedById\": \"410006e1-ca4e-4502-a9ec-e54d922d2c00\",\n \"ModifiedOn\": \"2016-09-15T14:27:21Z\",\n \"ModifiedById\": \"410006e1-ca4e-4502-a9ec-e54d922d2c00\",\n \"ProcessListeners\": 0,\n \"Dear\": \"\",\n \"SalutationTypeId\": \"7426ffb3-56e6-df11-971b-001d60e938c6\",\n \"GenderId\": \"eeac42ee-65b6-df11-831a-001d60e938c6\",\n \"AccountId\": \"405947d0-2ffb-4ded-8675-0475f19f5a81\",\n \"DecisionRoleId\": \"f71ee81d-0cac-4e41-b7dc-9d4bd2e08491\",\n \"TypeId\": \"00783ef6-f36b-1410-a883-16d83cab0980\",\n \"JobId\": \"cb49a603-57e6-df11-971b-001d60e938c6\",\n \"JobTitle\": \"Specialist\",\n \"DepartmentId\": \"2076c4b6-7fe6-df11-971b-001d60e938c6\",\n \"BirthDate\": \"1986-06-05T00:00:00Z\",\n \"Phone\": \"+1 617 440 2031\",\n \"MobilePhone\": \"+1 617 221 5187\",\n \"HomePhone\": \"\",\n \"Skype\": \"\",\n \"Email\": \"a.baker@ac.com\",\n \"AddressTypeId\": \"4f8b2d67-71d0-45fb-897e-cd4a308a97c0\",\n \"Address\": \"39 Columbia Street\",\n \"CityId\": \"74144617-a288-4984-bcac-e78733277a61\",\n \"RegionId\": \"658acfe7-09ae-4747-b1b3-541e2dfa1b9e\",\n \"Zip\": \"02112\",\n \"CountryId\": \"e0be1264-f36b-1410-fa98-00155d043204\",\n \"DoNotUseEmail\": false,\n \"DoNotUseCall\": false,\n \"DoNotUseFax\": false,\n \"DoNotUseSms\": false,\n \"DoNotUseMail\": false,\n \"Notes\": \"\",\n \"Facebook\": \"\",\n \"LinkedIn\": \"\",\n \"Twitter\": \"\",\n \"FacebookId\": \"\",\n \"LinkedInId\": \"\",\n \"TwitterId\": \"\",\n \"ContactPhoto@odata.mediaEditLink\": \"Contact(c4ed336c-3e9b-40fe-8b82-5632476472b4)/ContactPhoto\",\n \"ContactPhoto@odata.mediaReadLink\": \"Contact(c4ed336c-3e9b-40fe-8b82-5632476472b4)/ContactPhoto\",\n \"ContactPhoto@odata.mediaContentType\": \"application/octet-stream\",\n \"TwitterAFDAId\": \"00000000-0000-0000-0000-000000000000\",\n \"FacebookAFDAId\": \"00000000-0000-0000-0000-000000000000\",\n \"LinkedInAFDAId\": \"00000000-0000-0000-0000-000000000000\",\n \"PhotoId\": \"00000000-0000-0000-0000-000000000000\",\n \"GPSN\": \"\",\n \"GPSE\": \"\",\n \"Surname\": \"Baker\",\n \"GivenName\": \"Andrew\",\n \"MiddleName\": \"\",\n \"Confirmed\": true,\n \"IsNonActualEmail\": false,\n \"Completeness\": 30,\n \"LanguageId\": \"00000000-0000-0000-0000-000000000000\",\n \"Age\": 34\n },\n {\n \"Id\": \"9c2d2822-fc35-4ed5-a131-2f08bd4ab9f7\",\n \"Name\": \"Mary King\",\n \"OwnerId\": \"410006e1-ca4e-4502-a9ec-e54d922d2c00\",\n \"CreatedOn\": \"2020-02-04T12:43:53Z\",\n \"CreatedById\": \"76929f8c-7e15-4c64-bdb0-adc62d383727\",\n \"ModifiedOn\": \"2016-09-05T10:08:22Z\",\n \"ModifiedById\": \"76929f8c-7e15-4c64-bdb0-adc62d383727\",\n \"ProcessListeners\": 0,\n \"Dear\": \"King\",\n \"SalutationTypeId\": \"f4b32ee6-f36b-1410-aa84-00155d043204\",\n \"GenderId\": \"eeac42ee-65b6-df11-831a-001d60e938c6\",\n \"AccountId\": \"e308b781-3c5b-4ecb-89ef-5c1ed4da488e\",\n \"DecisionRoleId\": \"00000000-0000-0000-0000-000000000000\",\n \"TypeId\": \"60733efc-f36b-1410-a883-16d83cab0980\",\n \"JobId\": \"955472f0-56e6-df11-971b-001d60e938c6\",\n \"JobTitle\": \"\",\n \"DepartmentId\": \"2076c4b6-7fe6-df11-971b-001d60e938c6\",\n \"BirthDate\": \"1981-09-05T00:00:00Z\",\n \"Phone\": \"3020\",\n \"MobilePhone\": \"\",\n \"HomePhone\": \"\",\n \"Skype\": \"\",\n \"Email\": \"\",\n \"AddressTypeId\": \"4f8b2d67-71d0-45fb-897e-cd4a308a97c0\",\n \"Address\": \"73 Carson Road\",\n \"CityId\": \"a1bf2e42-f36b-1410-0499-00155d043204\",\n \"RegionId\": \"b1ae2e80-f36b-1410-3899-00155d043204\",\n \"Zip\": \"\",\n \"CountryId\": \"96ae123c-f46b-1410-f998-00155d043204\",\n \"DoNotUseEmail\": true,\n \"DoNotUseCall\": true,\n \"DoNotUseFax\": true,\n \"DoNotUseSms\": true,\n \"DoNotUseMail\": true,\n \"Notes\": \"\",\n \"Facebook\": \"\",\n \"LinkedIn\": \"\",\n \"Twitter\": \"\",\n \"FacebookId\": \"\",\n \"LinkedInId\": \"\",\n \"TwitterId\": \"\",\n \"ContactPhoto@odata.mediaEditLink\": \"Contact(9c2d2822-fc35-4ed5-a131-2f08bd4ab9f7)/ContactPhoto\",\n \"ContactPhoto@odata.mediaReadLink\": \"Contact(9c2d2822-fc35-4ed5-a131-2f08bd4ab9f7)/ContactPhoto\",\n \"ContactPhoto@odata.mediaContentType\": \"application/octet-stream\",\n \"TwitterAFDAId\": \"00000000-0000-0000-0000-000000000000\",\n \"FacebookAFDAId\": \"00000000-0000-0000-0000-000000000000\",\n \"LinkedInAFDAId\": \"00000000-0000-0000-0000-000000000000\",\n \"PhotoId\": \"00000000-0000-0000-0000-000000000000\",\n \"GPSN\": \"\",\n \"GPSE\": \"\",\n \"Surname\": \"\",\n \"GivenName\": \"\",\n \"MiddleName\": \"\",\n \"Confirmed\": false,\n \"IsNonActualEmail\": false,\n \"Completeness\": 30,\n \"LanguageId\": \"00000000-0000-0000-0000-000000000000\",\n \"Age\": 39\n }\n ]\n}"
}
]
}