Mailchimp Batch the resource submitted could not be validated array Schema describes object, NULL found instead - mailchimp

Posting a batch operation to Mailchimp I keep getting "schema describes object, NULL found instead" error. I get the error in them mailchimp playground https://us10.api.mailchimp.com/playground/. This was working fine for a year up to a few weeks ago and then stopped.
Response Body:
{"type":"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"Invalid Resource","status":400,"detail":"The resource submitted could not be validated. For field-specific details, see the 'errors' array.","instance":"70a5c431-1cc4-4933-a5c9-2ab84ed06263","errors":[{"field":"","message":"Schema describes object, NULL found instead"}]}
I've tried removing whitespace ,merged fields, and checking to be sure the merge fields natch the mailchimp list and verified the listID matching the correct list.
Any other suggestions would help?
Thanks
{"operations": [{
"method": "POST",
"path": "lists/436db7f77acd/members",
"body": "{\"email_address\":\"yahoo#yahoo.com\", \"status\":\"subscribed\"
,\"tags\":[\"Green Standard\", \"Customer Care\",\"96959N\"]
,\"merge_fields\": {
\"BADGE\": \"\",
\"CPATH\": \"https://secu/Certificate/96959N_0978317_Certificate.pdf\",
\"FNAME\": \"Charles\",
\"FRAME\": \"Coupon Code: 1CZ3d17 Expires: 12/31/2019\",
\"FRAMEHEAD\": \"Certificate\",
\"LNAME\": \"Gren\",
\"MKAL\": \"17MA19\",
\"MKAMT\": \"$250\",
\"MMERGE3\": \"Global Production\",
\"MMERGE4\": \"96959N\"
\"MMERGE5\": \"13d215\",
\"MMERGE6\": \"ABC, Inc.\"
}
}"
}]}

After removing all unnecessary spaces, tabs and whitespace, it's working now.
https://jsonlint.com was helpful

Related

GoogleJsonResponseException: API call to classroom.courses.courseWork.create failed with error: Internal error encountered

I can't understand why this piece of code suddenly returns internal error.
It was working like a charm, after a while it started to throw the error in header and there is nothing to do.
var courseWork = {
'title': 'Reglamento',
'description': 'Por favor, leer los documentos adjuntos.',
'materials': [
{'link': { 'url': linkDocumento }},
{'link': { 'url': "https://drive.google.com/file/d/1eESDk5HA3vR2IEbV0UglaR0F6UysuEmd/view?usp=sharing" }}
],
'workType': 'ASSIGNMENT',
// 'state': 'DRAFT',
'state': 'PUBLISHED',
'topicId': idTema
};
Classroom.Courses.CourseWork.create(courseWork, passa.idClasse);
Answer from the comments on the question:
Actually the problem was the document I was sharing. As I mentioned before, each month I generate 120 classrooms and in each one I put a document "Course Rules". This document is shared from my Drive account (Sharing rules is "Everyone that has the link can see"). Doing this the system charges to the document the link of each classroom that shares it and, I suppose, there is a limit in the number of links that a document can receive.
With a new copy of the document no more error. The workaround will be to copy the document in the classroom drive folder and share it from there.

Freebusy google API not getting returned with or w/o a key

As can be seen, Ihave read/write access to google calendar (sensitive scope). I want to also have access to freebusy scope of google calendar (not sensitive).
I followed the same steps but just provided a written justification instead of video as it's not sensitive as only sensitive scopes require one. Nonetheless, I am not getting granted permission nor are there any signs that's even being processed as it's been weeks. What shall I do?
I only see this on my dashboard which is for the other scope & feel like is the reason why the new scope is not getting reviewed despite my resubmission.
I know I have not been approved as the green check isn't displayed beside freebusy unlike auth/calendar
Currently, when I call the API:
Code:
def busyTimes():
"""
returns busy time of the user in a day
"""
body = {
"timeMin":datetime.now(timezone.utc).astimezone().isoformat(),
"timeMax": '2021-03-27T21:27:58.945714-04:00',
"items": [
{
"id": "....#group.calendar.google.com"
}
]
}
req = requests.post(url='https://www.googleapis.com/calendar/v3/freeBusy', data = body)
req_ = req.json()
return str(req_)
I would get:
{'error': {'code': 403, 'message': 'The request is missing a valid API key.', 'errors': [{'message': 'The request is missing a valid API key.', 'domain': 'global', 'reason': 'forbidden'}], 'status': 'PERMISSION_DENIED'}}
& if I were to include API key along the request.post() parameter I would get:
TypeError: request() got an unexpected keyword argument 'key'
and if I include it after the link like:
https://www.googleapis.com/calendar/v3/freeBusy?<apiKey>
I would get:
{'error': {'errors': [{'domain': 'global', 'reason': 'badRequest', 'message': 'Bad Request'}], 'code': 400, 'message': 'Bad Request'}}
P.S: the doc didn't doc even mention to include API.

How can I create an issue with github GraphQL API?

I'm starting to use GraphQL API and I've seen that the mutation createIssue was recently added but I don't know how to use it. I've tried the following but I'm getting errors:
mutation {
createIssue(input:{
repositoryId:"XXXXXXXXXXXX",
assigneeIds:"XXXXXXX",
title:"TestIssue",
body:"Not able to create an issue"})
}
You need first to get the repository id using the following request:
query FindRepo {
repository(owner: "johndoe", name: "awesome-repo") {
id
}
}
Then you call the mutation request by replacing the id you've got in the response in repositoryId field :
mutation CreateIssue {
createIssue(input: {repositoryId: "[ID from previous call]", title: "TestIssue", body: "Not able to create an issue"}) {
issue {
number
body
}
}
}
You can try both call in the graphql explorer and running first the FindRepo request and then CreateIssue
Or you can do it like this:
As the previous answer said, you have to find the repositoryId first, or you will met the error in the image.
And further more, when you have any issues finding a way to do mutation or query, you can find your answer in the Doc section in the right of the github explorer.

How to use a nested request with insights in the Facebook API

I am trying to include insights in a single call to Facebook ads API using Ruby. I researched this and got the following call:
params = {
'time_range': {
'since': '2019-08-01',
'until': '2019-08-31',
}
}
ad_account.campaigns(
fields: [
'adsets{
id,
insights{spend, impressions, clicks, ctr, cpc},
adcreatives{id, object_story_spec, image_url, object_type}
}'
],
params: params
).to_json
My response:
[
{
"adsets"=>{
"data"=>[
{
"id"=>"xxxxxxxxx",
"adcreatives"=>{
"data"=>
[
{
"id"=>"xxxxxxxxxxxxxx",
"object_story_spec"=>{
...
},
"image_url"=> "https://scontent.xx.fbcdn.net/v/xxxxxx",
"object_type"=>"SHARE"
}
],
"paging"=>{
"cursors"=>{
"before"=>"xxxxxx",
"after"=>"xxxxxxx"
}
}
}
}
],
...
So by levels, I am able to get all the campaigns, then the adsets inside them, and the adcreatives inside the adsets, but not the insights.
Am I doing something wrong? Does anyone have any experience with this?
So, surprisingly, Facebook DOES return insights with my call. Sometimes. No explanation why, but I tried with two accounts and got on one account insights and the other not.
Maybe it has something to do with the insights returned with this call have a shorter lifespan, so you can't get insights for older ads. Not sure. Not going to read through the million of pages.
My solution, for whoever is interested.
I made a call to adaccount insights directly, and specified the level as 'ad' so ir will return insights for all the account ads. I also requested the 'ad_id'. Later I was able to match the results returned with this call to the previous call I mentioned by comparing the ad ID, and merge the results.
ad_account.insights(
fields: ['ad_id', 'spend', 'impressions', 'clicks', 'ctr', 'cpc'],
level: 'ad',
time_range: {
since: date_since,
until: date_until
}
).to_json

Drive Api v3: Changes watch request TeamDriveId being ignored?

I'm trying to specify a Team Drive to watch according to the docs here: https://developers.google.com/drive/api/v3/reference/changes/watch
teamDriveId | string | The Team Drive from which changes will be returned. If specified the change IDs will be reflective of the Team Drive; use the combined Team Drive ID and change ID as an identifier.
(Side note teamDriveId appears to be deprecated in favour of driveId, but the docs don't reflect that)
I read that as saying if you supply an ID only changes related to that folder (File) and its children will cause a push notification, but I still get notifications for any changes in that user's Drive. Am I reading the docs incorrectly?
I originally posted the question to the DotNet client library repo as I'm doing this in C#. Jon Skeet suggested that IncludeItemsFromAllDrives should be false, which seems perfectly logical and I had tried that first because of that. However, that results in the following error being returned from the API endpoint:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "includeTeamDriveItemsRequired",
"message": "The includeItemsFromAllDrives parameter must be set to true when driveId is specified or corpora contains drive or allDrives."
}
],
"code": 403,
"message": "The includeItemsFromAllDrives parameter must be set to true when driveId is specified or corpora contains drive or allDrives."
}
}
I've tried several variations of the following properties to see if I can restrict it down to a Team Drive, but have been unsuccessful:
SupportsTeamDrives
SupportsAllDrives
IncludeItemsFromAllDrives
RestrictToMyDrive
Clarification would be very welcome.
Edit:
Code as requested, it's in C#, but the issue is likely to be the main API according to Jon Skeet:
Channel channel = new Channel()
{
Id = Guid.NewGuid().ToString(),
Type = "web_hook",
Address = [address],
Token = [token], //max 256 chars
Expiration = new DateTimeOffset(DateTime.Now.AddMinutes(10).ToUnixTimeMilliseconds(),
};
var watchRequest = _driveService.Changes.Watch(channel, startPageToken);
//watchRequest.SupportsTeamDrives = true;
watchRequest.SupportsAllDrives = true;
//watchRequest.TeamDriveId = rootFolderId;
//watchRequest.IncludeTeamDriveItems = true;
watchRequest.IncludeItemsFromAllDrives = true;
watchRequest.DriveId = rootFolderId;
watchRequest.RestrictToMyDrive = true;
channel = await watchRequest.ExecuteAsync();
I've tried several variations as the commented out code shows.

Resources