Using MailChimp API v3.0 can I filter out results using merge_fields? - mailchimp

I want to use MailChimp's API (v3.0) to get a list of my subscribers. Specifically, I want to only get subscribers with a first name of "Ken". This is the URL I've constructed to do that, but I'm not getting what I want. It returns a list of emails but they do not match my criteria.
Am I doing something wrong or is this not possible with 3.0?
https://us2.api.mailchimp.com/3.0/lists/<list_id>/members?members.merge_fields.FNAME=Ken
Here is the result I'd LIKE to get.
{
"members": [
{
"email_address": "kenjones#email.com",
"unique_email_id": "7cd36cf93c",
"status": "unsubscribed",
"merge_fields": {
"FNAME": "Ken",
"LNAME": "Jones"
}
]
}

Related

Microsoft graph API - unable to use $filter operation in "toRecipients" array

Hello guys hope ur doing good,
I want to filter out the graph api response based on the "toRecipient" which is a array, hence I used lambda expression, but it gives error.
"error": {
"code": "ErrorInvalidUrlQueryFilter",
"message": "The query filter contains one or more invalid nodes.",
"innerError": {
"date": "2021-09-22T06:04:17",
"request-id": "c6077cd4-dbec-4671-9c11-10e547917d29",
"client-request-id": "66dfbc92-2482-11f3-86f9-22652a4e4e00"
}
}
My actual response is
"toRecipients": [
{
"emailAddress": {
"name": "abc",
"address": "abc#abc.com"
}
}
],
I had used this operation to filter out
https://graph.microsoft.com/v1.0/me/mailFolders/sentItems/messages?&$top=1000&$search="abc#abc.com"
Graph API calls underlaying Office 365 API.
According to the documentation, property ToRecipients is not filterable.

How to returns all public tweets regarding for specific location using tweeter api

Is there an API call which will returns all recent public tweets regarding for specific location?
I tried GET trends/place but it's WOEID not worked for Sri Lanka and Cities.
(Sri Lanka WOEID is 23424778)
I don't want to use tweeter GET search/tweets.json endpoint because search based on certain key words.
Is there any solution for this?
Finally, I got the answer. We could not get trends on each and every location using tweeter API 1.1.
you have to check our closest trending place using this API call. For Austalia
https://api.twitter.com/1.1/trends/closest.json?lat=37.781157&long=-122.400612831116
the response like be this.
[
{
"country": "Australia",
"countryCode": "AU",
"name": "Australia",
"parentid": 1,
"placeType": {
"code": 12,
"name": "Country"
},
"url": "http://where.yahooapis.com/v1/place/23424748",
"woeid": 23424748
}
]
after that, you can use GET trends/place.
even though you cannot use GET trends/place for geo-based filtering you can use tweeter search endpoint. if you do not want to filter it by keyword ignore the q parameter and use geocodeparameter. for example,
https://api.twitter.com/1.1/search/tweets.json?result_type=recent&geocode=5.954920,80.554956,12mi
In here mi is miles.

How to get name/confidence individually from classify_text?

Most of the other methods in the language api, such as analyze_syntax, analyze_sentiment etc, have the ability to return the constituent elements like
sentiment.score
sentiment.magnitude
token.part_of_speech.tag
etc etc etc....
but I have not found a way to return name and confidence in isolation from classify_text. It doesn't look like it's possible but that seems weird. Am missing something? Thanks
The language.documents.classifyText method returns a ClassificationCategory object which contains name and confidence. If you only want one of the fields you can filter by categories/name or categories/confidence. As an example I executed:
POST https://language.googleapis.com/v1/documents:classifyText?fields=categories%2Fname&key={YOUR_API_KEY}
{
"document": {
"content": "this is a test for a StackOverflow question. I get an error because I need more words in the document and I don't know what else to say",
"type": "PLAIN_TEXT"
}
}
Which returns:
{
"categories": [
{
"name": "/Science/Computer Science"
},
{
"name": "/Computers & Electronics/Programming"
},
{
"name": "/Jobs & Education"
}
]
}
Direct link to API explorer for interactive testing of my example (change content, filters, etc.)

Finding cleaned/bounced email addresses for a MailChimp campaign or list

I'd like to automate the gathering of unsubscribe and cleaned email accounts for a given campaign.
In the API playground, I see all the methods available on the List entity.
Unsubscribes
I see that it's in the LIST API
GET reports/xxxxxx/unsubscribed
Cleaned
Where can I find the cleaned/bounced emails from a list or campaign? I know I can see the count of bounced in various places, but I'd like to find the email addresses that actually bounced, and the first and last names of the list member. Basically I'd like the API same as the 'export cleaned to csv' available on the website.
How can I use the MailChimp 3.0 API to do this?
You can do
GET lists/list_id/members?status=unsubscribed
to get unsubscribed users
GET lists/list_id/members?status=cleaned
to get cleaned/bounced users
For the bounced emails in a specific campaign you need to do this:
GET /3.0/reports/campaign_id/email-activity
and iterate though all recipients in the campaign, manually locating actions with type=bounce.
{
"email_address": "xxx#example.com",
"activity": [
{
"action": "bounce",
"type": "hard",
"timestamp": "2019-04-08T00:00:00+00:00"
}
]
},
Unfortunately MailChimp has very bad performance on this endpoint, approximately 25 seconds to return activity for a campaign with 500 recipients.
Since soft bounce will not change status inside the list(audience), to get soft bounce email from the list without specific campaign, you can use
GET lists/{list-id}/members/{subscriber_hash}/activity
This endpoint will only return for single email(contact), so you need to iterate through all email(contact) in the list.
Sample response:
"activity": [
{
"action": "bounce",
"timestamp": "2019-05-01T23:02:26+00:00",
"type": "soft",
"campaign_id": "xxxxxxxxxx",
"title": "Xxxx Xxxxxxx"
},
{
"action": "sent",
"timestamp": "2019-05-01T23:00:00+00:00",
"type": "regular",
"campaign_id": "xxxxxxxxxx",
"title": "Xxxx Xxxxxxx"
}
],

transfer a sibling element in a reponse to a parameter in Ready API / SOAP UI

I have one REST endpoint which returns a response like this
[
{
"id": "dbfff519-e8f6-4db3-9e26-a4e9014dc360",
"code": "123456789012345678901234567890123456789012345678901234567890",
"name": "client-code-with-character-length-sixty",
},
{
"id": "a673fb54-3503-4996-ba9b-a4e9014dc3ea",
"code": "18MTH",
"name": "18 Month",
},
{
"id": "60b781e3-4515-40f5-81ee-a4e9014dc400",
"code": "2periods",
"name": "I Have 2 Periods",
}...
etc.
I would like to be able to retrieve the ID where, for example, the code="2periods" UI can retrieve using either ResponseAsxml (with xpath) or Response with JSONPath. If I use the former I have managed to get the following to nearly retrieve my ID
//Response[1]/e[code='2periods']/id
BUT this looks like this
<id>0bc4aa5f-f8ab-4efe-b788-a4e9014dc45f</id>
And I don't know how to remove the start and end tags, the id has to be just the GUID.
I can't work out how to do something similar in the JSONPath - I've only managed to get something like
$[3].id
to work, but the order of the entities is not guaranteed in the test environment.
For ResponseAsXml using the XPath to get only the id value without <id> tag just add /text() to your actual expression:
//Response[1]/e[code='2periods']/id/text()
If you want to do the same using Response property with JSONPath try with:
$..[?(#.['code']=='2periods')].id[0]
Hope it helps,

Resources