I would like to create page with API.No matter I put the css in inline or internal way, API fail to handle it.Are there any way that can apply CSS to API call? Thank you.
Hi @CartonKam,
I can probably at least point you in the right direction... You'll definitely need to use inline CSS, and there are only certain properties Canvas allows. I think you're running into an issue of escaping or encoding your html before passing it via the API. If you create a page in RCE and then get it with the API, you'll see:
"body": "<p style=\"color: red;\">A red paragraph</p>"
The slashes essentially escape the double quotes so there isn't confusion as to where the string begins or ends. I'd suggest trying that to see if posting that would work as you expect.
I've also moved this to the developers area where people who are more coding/api experts than me hang out, so someone else might chime in with even more useful info or exact advice.
Hope this helps a bit!
-Chris
@CartonKam @matthew_buckett Does this method allow you to circumvent uploading a CSS file to the Theme Editor if using in a single course?
@cgaudreau Nope, sorry. The same filtering is applied when using the API as when using the web UI so it will still remove style tags.
Ah...I had a feeling, but couldn't hurt to ask. Thanks for confirming @matthew_buckett.
Thanks for the detailed response! I guess the lesson is "stick with in-line styles" unless you like living on the edge with the sword of damocles hanging over your head. Given that the HTML is generated using python, I can write a quick filter that converts the class tags into style tags and not have to worry.
I'm building a tool for my institution that imports grades from another LTI tool into Canvas so instructors can automate late assignment policies not otherwise supported by Canvas. I'm trying to use the LTIv1.3 ID which is readily available on the LTI-side as a link to the student record on Canvas, but I can't find the ID…
How can one track Canvas Media use without having the reports available from Canvas Studio? Checking API endpoints and the Data 2 schema, there do not seem to be dedicated Canvas Media endpoints. Am I missing some? A method I've considered is using the body field of the wiki_pages table, as this contains the html code of…
Hello, I'm trying to utilize an API call to pull completed certificates and was hoping to download and store the certs as a backup. I can successfully run the API call but it will not allow me to view the certificate unless I access the URL while signed into an account where it's "my" cert. Is there a permissions setting…
UI for weekly progression idea that rest in the Schedule tab of the **K-12 UI** of Canvas it's incomplete and I really would not take it and push it into instance but I am going to post it here because in the past people like @James && @robotcars || @Steve_25 have had terrific input in the past... maybe w/their eyes and…
I have a new React + Flask webapp. It has its own login for users to start using the app. I have added this as an external tool in Canvas. What I want initially is to see of canvas users can start using the webapp without having to login if they click on the external tool link in a canvas course. I have 2 methods…