How to retrieve ContactDetails if a subscription.edit event has fired?

(Connor Rossiter) #1

I am trying to identify the contact, whose subscription object was updated. I have setup a RestHook set to trigger on ‘subscription.edit’ event. From the Subscription Object ID , i receive in RestHook Call, How can i retrieve the Contact details to check which contact this subscription pertains to ?

(John Borelli) #2

The rest JSON returns the contact id and the record id (in this case from the recurring orders table). When your webhook endpoint receives this you must query the table using the id to get details

(Connor Rossiter) #3

@John_Borelli does the subscription.edit webhook event receive ContactID as the RecordID or Subscription ID? Can you share one example of such subscription.edit event please.

(John Borelli) #4

it receives the table id for the record type and the associated contact’s id. you just have to json_decode the json and you will have those elements available to you. The use the table id to get the information from the recurring order table.

(Connor Rossiter) #5

@John_Borelli Thanks for your valuable response. Can you please confirm if the RestApi Call ’ [ /orders/{orderId} ] hits the Recurring order Table . Also from the Table Schema Documentation @ , there is a table ’ [RecurringOrderWithContact]’ which saves you one API Call (fetches Contact in Same Call) , is there a RestApi Call for this.
Thanks Again

(John Borelli) #6

REST is still getting built out some. It doesn’t cover subscriptions yet, though the webhook for subscription.add works!/Account_Info/getAccountProfileUsingGET