I have a request, if possible I wish for toph.co API’s documentation to get problem solving related information of an user.
@Mestu_Paul Thanks for the suggestion. This is something we have in our roadmap. However, if you need something in specific immediately, you can let me know about that.
You see, although we have this in our roadmap, we may not be able to start working on API documentation until later this year. We have a few slightly higher priority to-dos (Print Server, Toph Box, Toph Quiz, Toph Battles, etc) at hand.
That is why if you currently need some specific APIs, and if you can describe your requirements, I can write a short outline of those APIs for you. I can also accommodate reasonable requests for new APIs in case existing APIs do not meet your needs.
I will ping you in a personal chat here in Community.
That’ll be great if we get an API.
So this means, although documentation will not be available soon. The work is done and we can manually ask how to get some data, what is that endpoint and how it works?
@hjr265 Bumping this topic.
I was wondering if you could give me an endpoint like api.toph.co/p/copycat
to get the information about the problem.
Example Response:
{
"ok": true,
"limits": {
"cpu": "1s",
"memory": "512MB",
"source": "150kB"
},
"solutionRatio": "91%",
"submissions": {
"earliest": "Mutasim",
"fastest": "Mutasim",
"lightest": "CCS_RUSHIKON",
"shortest": "kimiyuki"
}
}
@Nusab19 Sorry for taking a bit of time to get back.
You can now append “.json” at the end of problem page URLs to get problem related data formatted in JSON.
For example: https://toph.co/p/copycat.json
The layout of the JSON is not finalized yet, so it may change. I will leave a note here if any breaking changes are introduced.
Let me know if you have any questions.
@hjr265, can you add support for input / output in json also? This is helpful for things like Competitive Companion. I sometimes submit patches there and it looks like currently the extension is broken for toph:
I think extending the JSON support will make the extension support more stable and independent of theme change in site.
@touhidurrr Done
Example: https://toph.co/p/copycat.json
one more question, does it work on contest problems also? kindly let me know.
This only works for problems in Toph’s problem archive for now.
@hjr265 Could you add the total number of submissions in the json output?
can we get submissions of an user or any other information of an user?
like https://toph.co/user/submissions?
We may now provide JSON endpoints for specific “resources” but not for entire “collections” of data.
For example, we provide a JSON endpoint to get data about a specific problem. We are not yet providing a JSON endpoint that provides submissions made under that problem.
We can provide a JSON-formatted version of the profile page and the submission page. However, it may be a while before we can consider providing a JSON-formatted version of the submission list/filter pages.
These JSON endpoints are just a different format of the content you see in HTML on Toph. We do not consider them as APIs in its truest sense.
We plan to provide APIs with proper authentication and access control, but that is planned for later on our roadmap.
“We can provide a JSON-formatted version of the profile page and the submission page.”
Yes I also want this, user’s submission page.
For a specific user name expect profile page and submission page, submission page may contain problem id or name, verdict , submission time etc.