web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / 'Bad gateway error' in...
Power Automate
Unanswered

'Bad gateway error' in Power Automate Flow to create a sharepoint site page automatically

(1) ShareShare
ReportReport
Posted on by

Hi buddies, I'm a begineer in power automate and API Rest services and I have the following Issue.

 

I want to create a sharepoint site page with a power automate flow, the trigger of my flow is when item is created in a sharepoint list (Pages attributes), but when the flow is in the last step (Save page as draft) , The error 'Bad gateway error' appears after to a long compilation time.

 

This is my flow's steps:

 

Diemur9_6-1622223343945.png

 

Diemur9_0-1622225159559.png

 

 

Diemur9_5-1622223287712.png

 

Diemur9_8-1622223479454.png

 

I Place two images for the length of the last step.

 

Diemur9_9-1622223702518.png

 

Diemur9_10-1622223788513.png

 

Diemur9_11-1622223902752.png

 

Diemur9_12-1622223954800.png

 

And this is the error (2 Images) :

 

Diemur9_13-1622224151633.png

 

Diemur9_14-1622224361436.png

 

This is error message in body

 

"message""JsonToken EndObject is not valid for closing JsonType Array. Path '', line 1, position 2116.\r\nclientRequestId: 9024a74f-7c54-4f22-b2e9-89a6ae2990d2\r\nserviceRequestId: c15ecc9f-c092-0000-df36-1eb4b96d4dcc"
 

I have found two posts that say that the error would be because "///" "should be placed instead of double quotes, but I do not understand very well, they are not very clear about how and where I should apply this hypothetical solution.

If the solution has to do with this that I mention, could someone explain it to me much better please? or what would be the solution to this problem?

 

I would greatly appreciate the help and attention given.

 

 

 

 

Categories:
I have the same question (0)
  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @Anonymous  Can you share the json that you are passing in the body parameter, the issue could be related to double quotes in your data, use below expression to replace the double quote in compose action. First use compose action and copy the body parameter json in this action, rename this compose action to "BodyContent". Now again add compose action and use below expression in the compose action. Then use output of this second compose action in body parameter of Send HTTP Request to SharePoint action  

    replace(outputs('bodycontent'), '"', '\"')

     If it not a double quote issue, then i will have to review your json to see what is causing the issue.

  • Community Power Platform Member Profile Picture
    on at

    Hi @annajhaveri ,

     

    in advance, thank you very much for your attention and help, I'll tell you the result, when placing the replace it throws me the following error:

     

    Diemur9_0-1622480814917.png

     

    Unable to process template language expressions in action 'BodyContentReplace' inputs at line '1' and column '14878': 'The template language function 'replace' expects its first parameter 'string' to be a string. The provided value is of type 'Object'.

     

    How do I declare the first compose to be of type string? or what was the cause of the error?

     

    Thank u.

  • Community Power Platform Member Profile Picture
    on at

    @annajhaveri I do a update about the status to the issue.

     

    I was able to convert the output compose to a string but it still returns and throws me a bad gateway error:

     

    Diemur9_0-1622495569883.png

     

    This is the error JSON in body:

     
     Diemur9_5-1622496540890.png

     

    This is what I did according to what you told me this morning:
     
    I put all the content of the JSON method in the Body Content compose
     
    Diemur9_2-1622495892991.png

     

     then in a second compose I did the replace as you indicated it to me.

     

    Diemur9_3-1622496008237.png

    and lastly I just called the second compose in the body of the post method that saves as draft.

    Diemur9_4-1622496119172.png

     

    did I do something wrong ? 😞 Please I appreciate your answer and instruction.

  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @Anonymous  can you please share the full json that you are using in the BodyContent compose action, i will need to review the json to see whats causing the issue, as in your case even after replacing double quotes you are facing the same issue, so there must be something else in your json that is creating the issue. Please share your json as text in your next response.

  • Community Power Platform Member Profile Picture
    on at

    hi @annajhaveri good morning, this is the JSON:

     

    {
    "__metadata": {
    "type": "SP.Publishing.SitePage"
    },
    "LayoutWebpartsContent": "[{\"id\":\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\",\"instanceId\":\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\",\"title\":\"Área de título\",\"description\":\"Descripción del área de título\",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{},\"imageSources\":{},\"links\":{}},\"dataVersion\":\"1.4\",\"properties\":{\"title\":\"Test TP2\",\"imageSourceType\":4,\"layoutType\":\"FullWidthImage\",\"textAlignment\":\"Left\",\"showTopicHeader\":false,\"showPublishDate\":false,\"topicHeader\":\"\",\"authors\":[],\"authorByline\":[]},\"reservedHeight\":228}]",
    "AuthorByline": [],
    "TopicHeader": "",
    "BannerImageUrl": "https://xxxxx.sharepoint.com/_layouts/15/getpreview.ashx?guidSite=5032cc20eaf146668fada31ecc3c2ba2&guidWeb=fc406098c8e64e1eb25f6f7499056bdf&guidFile=26f93faab85c41348a9cf3342daea62f&ext=jpeg&ow=960&oh=640",
    "CanvasContent1": "[{\"controlType\":4,\"id\":\"4aa4dcde-f395-4e57-bd1d-ba87a5d4d30b\",\"position\":{\"zoneIndex\":0.5,\"sectionIndex\":1,\"controlIndex\":1,\"sectionFactor\":8,\"layoutIndex\":1},\"emphasis\":{},\"addedFromPersistedData\":true,\"innerHTML\":\"<p>@{triggerOutputs()?['body/Descripcion']}</p>\"},{\"controlType\":4,\"id\":\"e927e24b-9af6-46fa-b741-54044b3b8608\",\"position\":{\"zoneIndex\":0.5,\"sectionIndex\":2,\"controlIndex\":1,\"sectionFactor\":4,\"layoutIndex\":1},\"emphasis\":{},\"addedFromPersistedData\":true,\"innerHTML\":\"<ul><li>Language: @{triggerOutputs()?['body/Lenguaje']}</li><li>Framework: @{triggerOutputs()?['body/Framework']}</li><li>Category: @{triggerOutputs()?['body/Categoria']}</li><li>Automation Type: @{triggerOutputs()?['body/Tipo_Automatizacion']}</li><li>Vendor: @{triggerOutputs()?['body/Vendedor']}</li><li>Country: @{triggerOutputs()?['body/Pais']}</li></ul>\"},{\"controlType\":4,\"id\":\"45dd16e9-eda9-413a-a31d-a239a9327915\",\"position\":{\"zoneIndex\":0.5625,\"sectionIndex\":1,\"controlIndex\":1,\"sectionFactor\":8,\"layoutIndex\":1},\"emphasis\":{},\"addedFromPersistedData\":true,\"innerHTML\":\"<h4>Process</h4>\"},{\"position\":{\"zoneIndex\":0.5625,\"sectionIndex\":1,\"controlIndex\":2,\"layoutIndex\":1,\"sectionFactor\":8},\"controlType\":3,\"id\":\"ca8a781a-d0a3-4216-943b-ee1be7f18f17\",\"webPartId\":\"d1d91016-032f-456d-98a4-721247c305e8\",\"emphasis\":{},\"reservedHeight\":26,\"reservedWidth\":776,\"addedFromPersistedData\":true,\"webPartData\":{\"id\":\"d1d91016-032f-456d-98a4-721247c305e8\",\"instanceId\":\"ca8a781a-d0a3-4216-943b-ee1be7f18f17\",\"title\":\"Imagen\",\"description\":\"Agregue una imagen, una imagen o una foto a la página, incluyendo texto superpuesto y la capacidad de recortar y cambiar el tamaño de las imágenes.\",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{},\"imageSources\":{\"imageSource\":@{triggerOutputs()?['body/BotImage']}},\"links\":{},\"customMetadata\":{\"imageSource\":{\"siteId\":\"5032cc20-eaf1-4666-8fad-a31ecc3c2ba2\",\"webId\":\"fc406098-c8e6-4e1e-b25f-6f7499056bdf\",\"listId\":\"32dfc306-db0b-4b25-9067-e133bad7eb67\",\"uniqueId\":\"26f93faa-b85c-4134-8a9c-f3342daea62f\",\"width\":960,\"height\":640}}},\"dataVersion\":\"1.9\",\"properties\":{\"imageSourceType\":2,\"captionText\":\"\",\"altText\":\"\",\"linkUrl\":\"\",\"overlayText\":\"\",\"fileName\":\"\",\"siteId\":\"5032cc20-eaf1-4666-8fad-a31ecc3c2ba2\",\"webId\":\"fc406098-c8e6-4e1e-b25f-6f7499056bdf\",\"listId\":\"32dfc306-db0b-4b25-9067-e133bad7eb67\",\"uniqueId\":\"26f93faa-b85c-4134-8a9c-f3342daea62f\",\"imgWidth\":960,\"imgHeight\":640,\"alignment\":\"Center\",\"fixAspectRatio\":false}}},{\"position\":{\"zoneIndex\":0.5625,\"sectionIndex\":2,\"controlIndex\":1,\"sectionFactor\":4,\"layoutIndex\":1},\"controlType\":3,\"id\":\"11767d48-2bdd-45d1-8bf4-8034d932754b\",\"webPartId\":\"0f087d7f-520e-42b7-89c0-496aaf979d58\",\"emphasis\":{},\"reservedHeight\":40,\"reservedWidth\":372,\"addedFromPersistedData\":true,\"webPartData\":{\"id\":\"0f087d7f-520e-42b7-89c0-496aaf979d58\",\"instanceId\":\"11767d48-2bdd-45d1-8bf4-8034d932754b\",\"title\":\"Botón\",\"description\":\"Agregue un botón en el que hacer clic con una etiqueta personalizada y un vínculo.\",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{},\"imageSources\":{},\"links\":{}},\"dataVersion\":\"1.0\",\"properties\":{\"alignment\":\"Left\",\"label\":\"\"}}},{\"controlType\":4,\"id\":\"1c217819-825b-4ff5-bb5c-c86543f54b87\",\"position\":{\"zoneIndex\":0.65625,\"sectionIndex\":1,\"controlIndex\":1,\"sectionFactor\":12,\"layoutIndex\":1},\"emphasis\":{},\"addedFromPersistedData\":true,\"innerHTML\":\"<h4>Video Demo</h4><p><br></p>\"},{\"position\":{\"zoneIndex\":0.65625,\"sectionIndex\":1,\"controlIndex\":2,\"layoutIndex\":1,\"sectionFactor\":12},\"controlType\":3,\"id\":\"bd42000e-4572-49d1-9565-0d4be6d44a9b\",\"webPartId\":\"544dd15b-cf3c-441b-96da-004d5a8cea1d\",\"emphasis\":{},\"reservedHeight\":326,\"reservedWidth\":1180,\"addedFromPersistedData\":true,\"webPartData\":{\"id\":\"544dd15b-cf3c-441b-96da-004d5a8cea1d\",\"instanceId\":\"bd42000e-4572-49d1-9565-0d4be6d44a9b\",\"title\":\"YouTube\",\"description\":\"Muestre un vídeo de YouTube en la página.\",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{},\"imageSources\":{},\"links\":{}},\"dataVersion\":\"1.2\",\"properties\":{\"embedCode\":\"\",\"shouldScaleWidth\":true,\"thumbnailUrl\":\"\",\"webPartContentUrl\":\"\",\"runtimeState\":{\"isPrivate\":false,\"showControls\":true,\"startTime\":\"\"}}}},{\"controlType\":0,\"pageSettingsSlice\":{\"isDefaultDescription\":true,\"isDefaultThumbnail\":true}}]",
    "Title": "@{triggerOutputs()?['body/Title']}"
    }

     

    Thank u and I'm attentive to your reply.

  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @Anonymous  thanks for the json, sorry i will have to trouble you, can you provide the json from flow run, so that the dynamic content values are replaced in json

  • Community Power Platform Member Profile Picture
    on at

    @annajhaveriyes, The JSON that I sent you already has the dynamic values, I copied it as is from the body content, a dynamic value for example is 'Language', search for example the word 'Vendor' in the JSON and there you will find the dynamic values ​​you need.

     

    or did I understand wrong?

     

     

  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @Anonymous  the json that you provided has the dynamic content placeholders like @{triggerOutputs()?['body/Title']}, if you send the json from the flow run, then it will have the actual values in place of dynamic content placeholders, i hope that makes sense?

  • Community Power Platform Member Profile Picture
    on at

    ok, that is, I send you the normal JSON, without the dynamic values ​​of power automate, right?

    If so, then here I send you the normal JSON, the one obtained from the JSON event 'save page':

     

    {"__metadata":{"type":"SP.Publishing.SitePage"},
    "LayoutWebpartsContent":"[{\"id\":\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\",\"instanceId\":\"cbe7b0a9-3504-44dd-a3a3-0e5cacd07788\",\"title\":\"Área de título\",\"description\":\"Descripción del área de título\",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{},\"imageSources\":{},\"links\":{}},\"dataVersion\":\"1.4\",\"properties\":{\"title\":\"Test TP2\",\"imageSourceType\":4,\"layoutType\":\"FullWidthImage\",\"textAlignment\":\"Left\",\"showTopicHeader\":false,\"showPublishDate\":false,\"topicHeader\":\"\",\"authors\":[],\"authorByline\":[]},\"reservedHeight\":228}]",
    "AuthorByline":[],
    "TopicHeader":"",
    "BannerImageUrl":"https://xxxxx.sharepoint.com/_layouts/15/getpreview.ashx?guidSite=5032cc20eaf146668fada31ecc3c2ba2&guidWeb=fc406098c8e64e1eb25f6f7499056bdf&guidFile=26f93faab85c41348a9cf3342daea62f&ext=jpeg&ow=960&oh=640",
    "CanvasContent1":"[{\"controlType\":4,\"id\":\"4aa4dcde-f395-4e57-bd1d-ba87a5d4d30b\",\"position\":{\"zoneIndex\":0.5,\"sectionIndex\":1,\"controlIndex\":1,\"sectionFactor\":8,\"layoutIndex\":1},\"emphasis\":{},\"addedFromPersistedData\":true,\"innerHTML\":\"<p>{Descripcion}</p>\"},{\"controlType\":4,\"id\":\"e927e24b-9af6-46fa-b741-54044b3b8608\",\"position\":{\"zoneIndex\":0.5,\"sectionIndex\":2,\"controlIndex\":1,\"sectionFactor\":4,\"layoutIndex\":1},\"emphasis\":{},\"addedFromPersistedData\":true,\"innerHTML\":\"<ul><li>Language: {Lenguaje}</li><li>Framework: {Framework}</li><li>Category: {Categoria}</li><li>Automation Type: {Tipo_Automatizacion}</li><li>Vendor: {Vendedor}</li><li>Country: {Pais}</li></ul>\"},{\"controlType\":4,\"id\":\"45dd16e9-eda9-413a-a31d-a239a9327915\",\"position\":{\"zoneIndex\":0.5625,\"sectionIndex\":1,\"controlIndex\":1,\"sectionFactor\":8,\"layoutIndex\":1},\"emphasis\":{},\"addedFromPersistedData\":true,\"innerHTML\":\"<h4>Process</h4>\"},{\"position\":{\"zoneIndex\":0.5625,\"sectionIndex\":1,\"controlIndex\":2,\"layoutIndex\":1,\"sectionFactor\":8},\"controlType\":3,\"id\":\"ca8a781a-d0a3-4216-943b-ee1be7f18f17\",\"webPartId\":\"d1d91016-032f-456d-98a4-721247c305e8\",\"emphasis\":{},\"reservedHeight\":26,\"reservedWidth\":776,\"addedFromPersistedData\":true,\"webPartData\":{\"id\":\"d1d91016-032f-456d-98a4-721247c305e8\",\"instanceId\":\"ca8a781a-d0a3-4216-943b-ee1be7f18f17\",\"title\":\"Imagen\",\"description\":\"Agregue una imagen, una imagen o una foto a la página, incluyendo texto superpuesto y la capacidad de recortar y cambiar el tamaño de las imágenes.\",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{},\"imageSources\":{\"imageSource\":\"/sites/xxxxx/SiteAssets/SitePages/TPPlanti/61875-Trace-Bordo-Tecnología-·-Imagen-gratis-en-Pixabay.jpeg\"},\"links\":{},\"customMetadata\":{\"imageSource\":{\"siteId\":\"5032cc20-eaf1-4666-8fad-a31ecc3c2ba2\",\"webId\":\"fc406098-c8e6-4e1e-b25f-6f7499056bdf\",\"listId\":\"32dfc306-db0b-4b25-9067-e133bad7eb67\",\"uniqueId\":\"26f93faa-b85c-4134-8a9c-f3342daea62f\",\"width\":960,\"height\":640}}},\"dataVersion\":\"1.9\",\"properties\":{\"imageSourceType\":2,\"captionText\":\"\",\"altText\":\"\",\"linkUrl\":\"\",\"overlayText\":\"\",\"fileName\":\"\",\"siteId\":\"5032cc20-eaf1-4666-8fad-a31ecc3c2ba2\",\"webId\":\"fc406098-c8e6-4e1e-b25f-6f7499056bdf\",\"listId\":\"32dfc306-db0b-4b25-9067-e133bad7eb67\",\"uniqueId\":\"26f93faa-b85c-4134-8a9c-f3342daea62f\",\"imgWidth\":960,\"imgHeight\":640,\"alignment\":\"Center\",\"fixAspectRatio\":false}}},{\"position\":{\"zoneIndex\":0.5625,\"sectionIndex\":2,\"controlIndex\":1,\"sectionFactor\":4,\"layoutIndex\":1},\"controlType\":3,\"id\":\"11767d48-2bdd-45d1-8bf4-8034d932754b\",\"webPartId\":\"0f087d7f-520e-42b7-89c0-496aaf979d58\",\"emphasis\":{},\"reservedHeight\":40,\"reservedWidth\":372,\"addedFromPersistedData\":true,\"webPartData\":{\"id\":\"0f087d7f-520e-42b7-89c0-496aaf979d58\",\"instanceId\":\"11767d48-2bdd-45d1-8bf4-8034d932754b\",\"title\":\"Botón\",\"description\":\"Agregue un botón en el que hacer clic con una etiqueta personalizada y un vínculo.\",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{},\"imageSources\":{},\"links\":{}},\"dataVersion\":\"1.0\",\"properties\":{\"alignment\":\"Left\",\"label\":\"\"}}},{\"controlType\":4,\"id\":\"1c217819-825b-4ff5-bb5c-c86543f54b87\",\"position\":{\"zoneIndex\":0.65625,\"sectionIndex\":1,\"controlIndex\":1,\"sectionFactor\":12,\"layoutIndex\":1},\"emphasis\":{},\"addedFromPersistedData\":true,\"innerHTML\":\"<h4>Video Demo</h4><p><br></p>\"},{\"position\":{\"zoneIndex\":0.65625,\"sectionIndex\":1,\"controlIndex\":2,\"layoutIndex\":1,\"sectionFactor\":12},\"controlType\":3,\"id\":\"bd42000e-4572-49d1-9565-0d4be6d44a9b\",\"webPartId\":\"544dd15b-cf3c-441b-96da-004d5a8cea1d\",\"emphasis\":{},\"reservedHeight\":326,\"reservedWidth\":1180,\"addedFromPersistedData\":true,\"webPartData\":{\"id\":\"544dd15b-cf3c-441b-96da-004d5a8cea1d\",\"instanceId\":\"bd42000e-4572-49d1-9565-0d4be6d44a9b\",\"title\":\"YouTube\",\"description\":\"Muestre un vídeo de YouTube en la página.\",\"audiences\":[],\"serverProcessedContent\":{\"htmlStrings\":{},\"searchablePlainTexts\":{},\"imageSources\":{},\"links\":{}},\"dataVersion\":\"1.2\",\"properties\":{\"embedCode\":\"\",\"shouldScaleWidth\":true,\"thumbnailUrl\":\"\",\"webPartContentUrl\":\"\",\"runtimeState\":{\"isPrivate\":false,\"showControls\":true,\"startTime\":\"\"}}}},{\"controlType\":0,\"pageSettingsSlice\":{\"isDefaultDescription\":true,\"isDefaultThumbnail\":true}}]",
    "Title":"Test TP2"}

     

    I hope I have sent you what is necessary, thank you very much and I remain attentive.

  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at

    @Anonymous  i tried using your json and it worked fine, can you double check if your flow works now?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard