Pagination for gmb

Hey
I try to get data about all gmb locations from all 29 accounts and set up pagination for gmb accounts,as after 19 accounts it shows next page token, but it shows “The returned response was identical 5x, so requests got stopped” error all the time. Is there any way to fix it?

{
“nodes”: [
{
“parameters”: {
“jsCode”: “return items[0].json.accounts\n .filter(acc => acc.type === ‘LOCATION_GROUP’)\n .map(acc => {\n return {\n json: {\n accountId: acc.name,\n accountName: acc.accountName,\n type: acc.type,\n role: acc.role || ‘’,\n }\n };\n });\n”
},
“id”: “f617ee0e-3878-4483-b034-34d070c123ee”,
“name”: “Extract Account IDs”,
“type”: “n8n-nodes-base.code”,
“typeVersion”: 1,
“position”: [
-140,
300
],
“alwaysOutputData”: false
},
{
“parameters”: {
“jsCode”: “return items.flatMap(item =>\n (item.json.locations || )\n .map(loc => {\n return {\n json: {\n id: loc.name,\n name: loc.title || ‘’,\n address: (loc.storefrontAddress?.addressLines || ).join(', ') + ', ’ +\n (loc.storefrontAddress?.locality || ‘’) + ', ’ +\n (loc.storefrontAddress?.postalCode || ‘’),\n phone: loc.phoneNumbers?.primaryPhone || ‘’,\n website: loc.websiteUri || ‘’,\n description: loc.profile?.description || ‘’,\n category: loc.categories?.primaryCategory?.displayName || ‘’,\n displayName: loc.displayName || ‘’,\n status: loc.openInfo?.status || ‘’\n }\n };\n })\n);\n”
},
“id”: “e8432a9f-fc69-4c06-a825-bb47b187eb70”,
“name”: “Flatten Locations”,
“type”: “n8n-nodes-base.code”,
“typeVersion”: 1,
“position”: [
180,
300
]
},
{
“parameters”: {
“operation”: “append”,
“documentId”: {
“__rl”: true,
“value”: “1LjFzcGOCp7qqYRSAaXAFQJe5dmIuPH9ss3bEAzcEckg”,
“mode”: “list”,
“cachedResultName”: “n8n gmb”,
“cachedResultUrl”: “https://docs.google.com/spreadsheets/d/1LjFzcGOCp7qqYRSAaXAFQJe5dmIuPH9ss3bEAzcEckg/edit?usp=drivesdk
},
“sheetName”: {
“__rl”: true,
“value”: “gid=0”,
“mode”: “list”,
“cachedResultName”: “Info”,
“cachedResultUrl”: “https://docs.google.com/spreadsheets/d/1LjFzcGOCp7qqYRSAaXAFQJe5dmIuPH9ss3bEAzcEckg/edit#gid=0
},
“columns”: {
“mappingMode”: “defineBelow”,
“value”: {
“Location Name”: “={{ $json.name }}”,
“Address”: “={{ $json.address }}”,
“Website”: “={{ $json.website }}”,
“Description”: “={{ $json.description }}”,
“Category”: “={{ $json.category }}”,
“Location id”: “={{ $json.id }}”,
“Phone”: “={{ $json.phone }}”,
“Open status”: “={{ $json.status }}”
},
“matchingColumns”: ,
“schema”: [
{
“id”: “Location id”,
“displayName”: “Location id”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: true
},
{
“id”: “Location Name”,
“displayName”: “Location Name”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: true
},
{
“id”: “Address”,
“displayName”: “Address”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: true
},
{
“id”: “Phone”,
“displayName”: “Phone”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: true,
“removed”: false
},
{
“id”: “Website”,
“displayName”: “Website”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: true
},
{
“id”: “Description”,
“displayName”: “Description”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: true
},
{
“id”: “Category”,
“displayName”: “Category”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: true
},
{
“id”: “Open status”,
“displayName”: “Open status”,
“required”: false,
“defaultMatch”: false,
“display”: true,
“type”: “string”,
“canBeUsedToMatch”: true,
“removed”: false
}
],
“attemptToConvertTypes”: false,
“convertFieldsToString”: false
},
“options”: {}
},
“type”: “n8n-nodes-base.googleSheets”,
“typeVersion”: 4.6,
“position”: [
400,
300
],
“id”: “3bab0648-df6d-4787-8b51-3409eda7918e”,
“name”: “Google Sheets1”,
“alwaysOutputData”: true,
“credentials”: {
“googleSheetsOAuth2Api”: {
“id”: “nvSgz0VqylkcKNrk”,
“name”: “Google Sheets account”
}
}
},
{
“parameters”: {
“url”: “https://mybusinessbusinessinformation.googleapis.com/v1/accounts”,
“authentication”: “predefinedCredentialType”,
“nodeCredentialType”: “googleBusinessProfileOAuth2Api”,
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
-480,
300
],
“id”: “06c8e643-88f0-49ec-b587-a27c00c99428”,
“name”: “Search Accounts”,
“credentials”: {
“googleBusinessProfileOAuth2Api”: {
“id”: “lfNYou72cIzpdjdm”,
“name”: “Google Business Profile account”
}
}
},
{
“parameters”: {
“url”: “=https://mybusinessbusinessinformation.googleapis.com/v1/accounts/116922929083824783803/locations/?pageSize=100&readMask=name,title,storefrontAddress,phoneNumbers,websiteUri,categories,profile,metadata,openInfo”,
“authentication”: “predefinedCredentialType”,
“nodeCredentialType”: “googleBusinessProfileOAuth2Api”,
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
40,
300
],
“id”: “5ea7ca56-d77b-4dec-b945-8b222e2ab078”,
“name”: “Search Locations”,
“credentials”: {
“googleBusinessProfileOAuth2Api”: {
“id”: “lfNYou72cIzpdjdm”,
“name”: “Google Business Profile account”
}
}
},
{
“parameters”: {
“rule”: {
“interval”: [
{
“field”: “months”
}
]
}
},
“type”: “n8n-nodes-base.scheduleTrigger”,
“typeVersion”: 1.2,
“position”: [
-700,
300
],
“id”: “c333294e-8a54-4707-9ef9-7ba59686263b”,
“name”: “Schedule Trigger”
},
{
“parameters”: {
“url”: “https://mybusinessbusinessinformation.googleapis.com/v1/accounts”,
“authentication”: “predefinedCredentialType”,
“nodeCredentialType”: “googleBusinessProfileOAuth2Api”,
“options”: {
“pagination”: {
“pagination”: {
“parameters”: {
“parameters”: [
{
“name”: “pageToken”,
“value”: “={{ $json.nextPageToken }}”
}
]
},
“paginationCompleteWhen”: “other”,
“completeExpression”: “={{ !$json.nextPageToken }}”
}
}
}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
-320,
200
],
“id”: “22e90f6b-7369-42cb-b22f-e30ac7389a6a”,
“name”: “Search Accounts1”,
“credentials”: {
“googleBusinessProfileOAuth2Api”: {
“id”: “lfNYou72cIzpdjdm”,
“name”: “Google Business Profile account”
}
}
}
],
“connections”: {
“Extract Account IDs”: {
“main”: [
[
{
“node”: “Search Locations”,
“type”: “main”,
“index”: 0
}
]
]
},
“Flatten Locations”: {
“main”: [
[
{
“node”: “Google Sheets1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Search Accounts”: {
“main”: [
[
{
“node”: “Search Accounts1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Search Locations”: {
“main”: [
[
{
“node”: “Flatten Locations”,
“type”: “main”,
“index”: 0
}
]
]
},
“Schedule Trigger”: {
“main”: [
[
{
“node”: “Search Accounts”,
“type”: “main”,
“index”: 0
}
]
]
},
“Search Accounts1”: {
“main”: [
[
{
“node”: “Extract Account IDs”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“instanceId”: “bebb8409d79da2f82d8358b7e6eabe3302ca11a3429ea58cac54ff99330d003c”
}
}

Output
[
{
“accounts”: [
{
“name”: “accounts/109862043660814888414”,
“accountName”: “Lukasz Trzonek”,
“type”: “PERSONAL”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”
},
{
“name”: “accounts/109746101994548650792”,
“accountName”: “Acquisitions”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “VERIFIED”,
“vettedState”: “NOT_VETTED”,
“accountNumber”: “5548404802”,
“permissionLevel”: “OWNER_LEVEL”
},
{
“name”: “accounts/105558507456433360853”,
“accountName”: “Apteka Medicover”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”,
“accountNumber”: “5243143418”,
“permissionLevel”: “OWNER_LEVEL”
},
{
“name”: “accounts/104673246857059620553”,
“accountName”: “Born Donor Bank”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”,
“permissionLevel”: “OWNER_LEVEL”
},
{
“name”: “accounts/105538250694854232498”,
“accountName”: “Centra Medicover”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”,
“accountNumber”: “5108355449”,
“permissionLevel”: “OWNER_LEVEL”
},
{
“name”: “accounts/100871912222460133681”,
“accountName”: “Centrum Medyczne Damiana”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”,
“permissionLevel”: “OWNER_LEVEL”
},
{
“name”: “accounts/111476906861606312296”,
“accountName”: “CityFit - All”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”,
“accountNumber”: “5795467363”,
“permissionLevel”: “OWNER_LEVEL”
},
{
“name”: “accounts/115685363672634861134”,
“accountName”: “ddent”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”,
“permissionLevel”: “OWNER_LEVEL”
},
{
“name”: “accounts/117553589487274438811”,
“accountName”: “Dom lekarski”,
“type”: “LOCATION_GROUP”,
“role”: “MANAGER”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”,
“accountNumber”: “5883843684”,
“permissionLevel”: “MEMBER_LEVEL”
},
{
“name”: “accounts/104491296159981570492”,
“accountName”: “Invimed”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”,
“permissionLevel”: “OWNER_LEVEL”
},
{
“name”: “accounts/108549050250823990586”,
“accountName”: “Just GYM”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”,
“accountNumber”: “5705737504”,
“permissionLevel”: “OWNER_LEVEL”
},
{
“name”: “accounts/114679530283462675726”,
“accountName”: “KinderDentist”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”,
“permissionLevel”: “OWNER_LEVEL”
},
{
“name”: “accounts/113855148823209651265”,
“accountName”: “Klinikk Hausken”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”,
“permissionLevel”: “OWNER_LEVEL”
},
{
“name”: “accounts/107235093853846984261”,
“accountName”: “McFit, Premium, Stellar”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”,
“accountNumber”: “5607030453”,
“permissionLevel”: “OWNER_LEVEL”
},
{
“name”: “accounts/118087571796927475713”,
“accountName”: “MCV”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”,
“permissionLevel”: “OWNER_LEVEL”
},
{
“name”: “accounts/107756589890408145228”,
“accountName”: “Medicover India”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”,
“permissionLevel”: “OWNER_LEVEL”
},
{
“name”: “accounts/112412745347133919633”,
“accountName”: “Medicover Optyk”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”,
“accountNumber”: “5556347283”,
“permissionLevel”: “OWNER_LEVEL”
},
{
“name”: “accounts/109461995800123066546”,
“accountName”: “Medicover Romania”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “VERIFIED”,
“vettedState”: “NOT_VETTED”,
“accountNumber”: “5382894887”,
“permissionLevel”: “OWNER_LEVEL”
},
{
“name”: “accounts/112912152627080719419”,
“accountName”: “Medicover Stomatologia”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”,
“permissionLevel”: “OWNER_LEVEL”
},
{
“name”: “accounts/104389902836589156079”,
“accountName”: “Medicover UA”,
“type”: “LOCATION_GROUP”,
“role”: “PRIMARY_OWNER”,
“verificationState”: “UNVERIFIED”,
“vettedState”: “NOT_VETTED”,
“permissionLevel”: “OWNER_LEVEL”
}
],
“nextPageToken”: “ABHRLXUEl354f5QgLLfPNTNUHp1jglFIQr7EiWzLVmfXhoX2GsMfH3fA1FoXhEjB0ARmM2zAVYxXCf7g2GrV0MfjsBtTZYE5HwX86u4Uh_-TjgwtYvQiqz2yShz1ZytMjV8aCACTvHhl”
}
]

means that the remote server returned status code 500 (server side error) more than once in a row and n8n decided not to proceed with pagination, because something is clearly wrong.

So why did the remote server return 500s?

Id also like to know why

Well, for that you’d need to analyze the requests, responses and hopefully this will give you enough details to make an educated guess as to why the remote server doesn’t like you requests.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.