I am using mailchimp to display all the newsletters in my webpage.
Am using this API call to get all newsletters, https://usX.api.mailchimp.com/3.0/campaigns
But am only getting 10 campaigns, but there are many more campaigns in the mailchimp account.
Is there anything wrong here?
How can I get all the newsletters or all campaign ids?
According to the official documentation of the /campaigns endpoint here, there is a count parameter that indicates the number of campaign records you want to return. The default value of the count parameter is 10. You're not passing any parameters to the /campaigns endpoint, so the default value of the count parameter (10) is used and that's why you only get 10 campaigns.
You can get all campaigns by making two API calls to the /campaigns endpoint. Make the first API call with count parameter set to 1. You will get only one campaign, but you will also get total_items in the response body. The value of total_items shows the total number of campaigns you currently have in your MailChimp account. The second API call should have count parameter set to the value of total_items obtained from the response of the first API call. You will get all campaigns in the response body of the second API call.
Related
I am trying to get a list of my public subscribers. When I execute the request below I get weird and inconsistent results. When I ask for a max result size of 50 I get two pages back, one with 27 and another with 9. Also when I look at my web page subscribers it says I only have 24 public subscribers. I have 95 total subscribers.
Why is it paging in buckets less than my max page size?
Why are the reported numbers so far off?
https://www.googleapis.com/youtube/v3/subscriptions?part=subscriberSnippet&mySubscribers=true&key=[MY_API_KEY]
According to the official docs, for to call the Subscriptions.list API endpoint with parameter mySubscribers=true you have to pass on to the endpoint proper authorization credentials:
mySubscribers (boolean)
This parameter can only be used in a properly authorized request. Set this parameter's value to true to retrieve a feed of the subscribers of the authenticated user in no particular order.
Therefore, passing on only an application key, via the parameter key, is not sufficient. If passing on proper authorization credentials (i.e. a valid access token), then the key parameter is superfluous.
We are using Yammer API Call: https://www.yammer.com/api/v1/groups.json to get the yammer groups for our organization. But we are getting only 50 groups for this call. However we are having more than 50. Any thoughts on this issue?
To get groups beyond the first batch you have to pass a page parameter like this https://www.yammer.com/api/v1/groups.json?page=5. Continue paging until you run out of results. Getting only the groups.csv model using the Yammer Data Export is often a faster method, but places additional constraints on the API caller.
I've read the official document of Google Contacts API version 3.0.
(https://developers.google.com/contacts/v3/)
On the part of 'Retrieving all contacts' there is a note saying below:
The feed may not contain all of the user's contacts, because there's a default limit on the number of results returned. For more information, see the max-results query parameter in Retrieving contacts using query parameters.
I wonder that 'default limit' because I would like to refer to Google's standard for developing.
Is there anyone who knows the number of default limit?
The default max depends upon the API and the method itself. Some of the Youtube methods only return 50 for a max others return 500.
Unfortunately the Google contacts API is a very old API and not well documented. If you dont send a max-results with your request then you will get the default.
You can also send something really big like 100000 if it refuses it it should return an error stating its max.
Is there any direct way to get the last campaign sent on a Mailchimp account via Mailchimp API V3?
So far the only way I found was to iterate over the campaigns and get the last one but it takes too much time.
Thanks in advance.
This is what I did:
/campaigns?sort_field=send_time&sort_dir=DESC&status=sent&count=1
Or for anyone who needs the last campaign from a particular folder:
/campaigns?folder_id=[FOLDER ID]&sort_field=send_time&sort_dir=DESC&status=sent&count=1
I don't think you can get only the last campaign sent using only one request, but you can achieve this by making two requests to the following endpoint
/campaigns
as described here. The parameters that you need are count, status, and offset.
For the first request, set the count parameter to 1 and status parameter to sent. You will get the first campaign sent, but you will also get total_items in the response body. The total_items indicates the total number of sent campaigns in your MailChimp account regardless of the pagination and that's what you need to make the second request.
For the second request, set the count parameter to 1, status parameter to sent, and offset parameter to the value of total_items above - 1. For example if the total_items from the first request is 150, then you should set offset to 149. Setting the offset parameter to 149 will skip the first 149 sent campaigns. The campaigns field in the response of the second request will contain the last campaign sent from your MailChimp account, which is what you're looking for. This will be much quicker than enumerating through all of the sent campaigns.
I've noticed that the messages.json endpoint doesn't seem to return all the data needed to show the likes per message.
Specifically, two things seem to be happening:
List of likers only has info on 3 users.
The avatar images for the likers is not always available when looking up through the "references" array.
We're using the JS SDK for our integration.
Thanks
https://api.yammer.com/api/v1/users/liked_message/:Message_id.json should return user properties of LIKERS, a count of all LIKERS should give you the total LIKES per message.
In practice, you'd need to call the messages endpoint, get the message id, then pass it into users/liked_message/:Message_id.json programatically.
See here for further details - https://developer.yammer.com/docs/usersliked_messagemessage_idjson