Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing SageMathCell as a web API #469

Closed
paulmasson opened this issue Aug 15, 2016 · 6 comments
Closed

Accessing SageMathCell as a web API #469

paulmasson opened this issue Aug 15, 2016 · 6 comments

Comments

@paulmasson
Copy link
Contributor

Inspired by this ask question, would it be possible to access the results of SageMathCell as a JSON string? This would of course only apply to calculations whose results can be returned in JSON format.

For example, evaluating P=Primes(); print P.next(2016) in the cell returns the answer in a <pre> tag with the class sagecell_stdout. Could outputs with this class name optionally be returned by the server as JSON?

@novoselt
Copy link
Member

novoselt commented Aug 15, 2016

This may be it: https://github.com/sagemath/sagecell/wiki/Messages#blocking-web-service

Better documentation/examples/etc are always welcome. Source code for processing these requests is here: https://github.com/sagemath/sagecell/blob/master/handlers.py#L323

@paulmasson
Copy link
Contributor Author

Thanks for the info! Hadn't seen this page before.

Finally got the service to work at the command line and using XMLHttpRequest, which was a fun diversion. I've updated my answer at ask.sagemath.org, but I'll also add a bunch of that to the documention here since there are some big gaps.

@paulmasson
Copy link
Contributor Author

@novoselt the documentation for this service is in the wiki, which is not open to me for editing. Since there doesn't appear to be a way to create pull requests against a wiki on Github, how do you want to handle updates? Create documents in the code repository or something else?

@paulmasson
Copy link
Contributor Author

paulmasson commented Aug 30, 2016

@novoselt I've created a short page on my website with the basics of using the web service:

Accessing SageMath as a Web Service

Feel free to copy what you want to this wiki. There's a link at the bottom to an example application that downloads data from the server to visualize real and imaginary parts of special functions with Three.js.

@novoselt
Copy link
Member

I actually don't want to copy anything to the wiki and would very much prefer to have all documentation in the same repository as the code as it is already the case with embedding instructions. What are advantages of this wiki??? If you are willing to do the move I'll be happy to merge pull requests ;-)

@paulmasson
Copy link
Contributor Author

Moving documentation from wiki commenced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants