Coming soon: The SuperOffice Community will get a major update Learn more

Getting e-marketing consent

Hi

I am trying to figure out the best way to get selected e-marketing options, for multiple persons at one time.

Can anyone please tell me how to do this?

Any suggestion will be appreciated.

Kind regards

Michael

RE: Getting e-marketing consent

Hi Michael,

Assuming you are using REST...

Because no direct API exists to get this list, you have to perform the business logic yourself. Pay attention to Step #3, it's the important bit...

Step #1) Get the list of ShipmentTypeReservation including the person_id's you want to search for...

@query = shipmenttypereservation.person_id,shipmenttypereservation.shipmenttype_id
@filter = shipmenttypereservation.person_id in (5,7,17) 

GET /api/v1/archive/dynamic?$select={{query}}&$filter={{filter}}
Authorization: Bearer {{token}}
Content-Type: application/json
Accept: application/json
 
Step #2) Get the list of ShipmentTypes (MDOListItem.Id maps to the ShipmentType_id)
GET /api/v1/MDOList/shipmenttype
Authorization: Bearer {{token}}
Accept: application/json
Accept-Language: da
 

Step #3) Deduce what the selected items are by _not_ being present in the list returned in Step #1. In other words, the results from step #1 only contain persons who have at least one E-marketing item selected, and the id's returned at those that are _not_ selected.

I would also listen to what Conrad told you in your other post. If someone just turns off the slider completely, this will not remove the items in the shipmenttypereservation table...

You can determine who has the E-marketing slider on by checking the consentperson table.

@token = 8A...CyM
@query = consentperson.person_id

#assuming 2 is E-marketing (consentpurpose)
@filter = consentperson.consentpurpose_id = 2 

GET /api/v1/archive/dynamic?$select={{query}}&$filter={{filter}}
Authorization: Bearer {{token}}
Content-Type: application/json
Accept: application/json
I hope this helps!
Von: Tony Yates 21. Aug 2020