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 @ https://developer.infusionsoft.com/docs/table-schema/ , 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

https://developer.infusionsoft.com/docs/rest/#!/Account_Info/getAccountProfileUsingGET


(Connor Rossiter) #7

@John_Borelli I was expecting above Response from the webhook event ‘subscription.edit’. However i am only getting the ‘subscription ID’ . And seems there is no way to know which contact this Subscription belongs to because there in no GetSubscription Rest Api Call. Any ideas please?
Below is the webhook response i am seeing:
{“event_key”:“subscription.edit”,“object_type”:“subscription”,“object_keys”:[{“apiUrl”:"",“id”:21383,“timestamp”:“2019-02-14T15:22:47Z”}],“api_url”:""}


(Nicholas Trecina) #8

Hi @Connor_Rossiter, unfortunately at this time there isn’t a way to get subscriptions via the REST API. Your only option would be to use XML-RPC’s DataService.load on the RecurringOrder table with the id from your REST Hook payload.