The Instructure Community is fully available, including guides, release notes, forums, and groups. If some styling still looks unusual, clear your cache and cookies.
Found this content helpful? Log in or sign up to leave a like!
Hello all,
I'm trying to update a page body, using "https://canvas.instructure.com/doc/api/pages.html#method.wiki_pages_api.update_front_page".
It works, but if the body contains an ampersand (&) it will ignore the block with that sign and any blocks after that. No error but a truncated body as result.
Any thoughts/help are appreciated.
Hi @HosseinErfani,
I assume the body you're trying to send is html code, correct? Are you HTML encoding characters like the &? I believe a straight & character in HTML code is considered invalid, so if you're just sending that by itself, thats' probably why Canvas is choking on the rest of the input, but it's hard to say with 100% certainty without seeing exactly what you're trying to send.
-Chris
Thank you so much @chriscas,
Yes, it's an HTML code, and the '&' is a part of a URL in the code as a value of an src property. I'm trying to develop a PHP code to update a list of pages. Actually, by replacing it with "%26" the problem has been solved, but I'm wondering if there are any other illegal characters or not.
Is there a document on the list of illegal characters for updating wiki_page[body] in Canvas?
/Hossein
Hi @HosseinErfani,
Ah, so it's part of.a URL, that's a slightly different beast. The good news is that since you seem to be using PHP, there's a built-in rawurlencode function to encode the URL for you and remove any illegal characters. Just pass your desired URL to that function. There appears to be a similar function for the HTML code as well. I will say that I'm not a PHP programmer at all, so I just googled to find those functions, and I hope they are correct. I'me run across similar issues with other projects I've worked on in the past, so I just have some basic knowledge of the issue.
Hope this helps a bit!
-Chris
To interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in