I was able to get details of the UI abstracted child campaign created and used by an email send program through the get campaign by id endpoint, FYR - I used the campaign id from the activities response. And, since the email assets with A/B test and Champion challenger test are not accessible via email endpoints (ref this page from the dev docs), it would make sense to use the lead activities API endpoint to get email asset details - this thread tells me that the e-mails that had A/B tests will have an ".Whole Emails Test"/".Subject Line Test" appended to their name in the activities response.
I setup a sample A/B test in my SB instance to cross check some facts, below are some notes from the results:
- Marketo creates different UI abstracted campaigns for sending the test variants and sending the winner email variant to the applicable audience. Id's of the campaigns can be obtained from the activities endpoint, and get campaign by id endpoint can be queried for campaign's additional details.
- The test variant parameter with value as a numeric id is only included in the email activities for the test group - for the winner group the attributes array in the JSON response does not include the Test Variant parameter - hence your parser probably returned null as a value for test variant parameter for the winner email activities.
AFAIK, I don't think there exists an API call to query the test variants used for the A/B testing, however as a workaround - you can either export the test variant data from the dashboard of the email program or from an email analysis report in the revenue cycle explorer.