Remove the WebworkWebservice and replace it with the webwork API. - #3125
Open
drgrice1 wants to merge 1 commit into
Open
Remove the WebworkWebservice and replace it with the webwork API.#3125drgrice1 wants to merge 1 commit into
drgrice1 wants to merge 1 commit into
Conversation
somiaj
approved these changes
Aug 11, 2026
somiaj
left a comment
Contributor
There was a problem hiding this comment.
Rendering problems in my course websites via the rpc still works in my setup and I did a few tests of the library browser and problem editor. Everything seems to work. Anything particular we should test?
Member
Author
|
In addition to problem rendering, check that the single problem grader works. The library browser also uses the API end points. The timer in the gateway quiz uses it (this is the only student usage). |
drgrice1
force-pushed
the
rpc-to-api
branch
2 times, most recently
from
August 12, 2026 11:22
ca0b412 to
6ceb344
Compare
In reality the functionality of the `WebworkWebservice` routes is basically the same, but the `WebworkWebservice` package is an unnecessary layer of code for the functionality of these routes. So it is removed. The `WeBWorK::ContentGenerator::RenderViaRPC` still handles the `render_rpc` route and its functionality is unchanged. It just doesn't go through the unnecessary layer of the `WebworkWebservice` package. The `lib/RenderProblem.pm` module is integrated directly into the `WeBWorK::ContentGenerator::RenderViaRPC` package. The `instructor_rpc` route has been removed, and is replaced with the `api` routes, and the `WeBWorK::ContentGenerator::InstructorRPCHandler` package functionality is now in the `WeBWorK::ContentGenerator::API` package. The `api` routes are fundamentally different than the `instructor_rpc` route. Instead of the single `instructor_rpc` route that requires an `rpc_command` parameter, the desired API command is part of the route. So, for example, instead of using the `webwork2/instructor_rpc` route with the parameter `rpc_command=putUserProblem` you use the route `webwork2/api/putUserProblem`. The remainder of the parameters for each command are the same as before. All of the `api` routes are implemented in the `WeBWorK::ContentGenerator::API` packages which are basically the previous `WebworkWebservice` packages. One notable difference is that each method is responsible for checking any necessary permissions required to use the route it provides. This is the same as all of the other `ContentGenerator` packages. There is a difference in the rendered JSON response for these routes. The `server_response` and `result_data` keys are not there at all anymore. Each route can determine what it really needs to return. Before the `result_data` was really what should have just been the returned data, and the `server_response` return value was a useless thing to return that was never used. Note that all of the methods pass through the `WeBWorK::ContentGenerator::API` base package, and that could render a response with the `error` key (if the user is not authenticated or the command is not found), and any of the `API` methods that provide a route can do so as well. The `renderError` method in the base package is a convenience for doing so. At this point all `api` routes require the user to be authenticated, but if we need `api` routes that do not require authentication (as before with the `instructor_rpc` route), that would not be hard to implement with some slight restructuring. All of webwork2's usage of these routes in JavaScript has been updated. Generally the `instructor_rpc` route is only used by webwork2, so this change should not affect anyone else. Part of the reason for this is that the `instructor_rpc` route was already not only for instructors. Students now use this route for tests to obtain the server time which ensures the remaining time displayed during a test is correct. The plan is to eventually implement a way of saving answers during tests via an api route as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In reality the functionality of the
WebworkWebserviceroutes is basically the same, but theWebworkWebservicepackage is an unnecessary layer of code for the functionality of these routes. So it is removed.The
WeBWorK::ContentGenerator::RenderViaRPCstill handles therender_rpcroute and its functionality is unchanged. It just doesn't go through the unnecessary layer of theWebworkWebservicepackage. Thelib/RenderProblem.pmmodule is integrated directly into theWeBWorK::ContentGenerator::RenderViaRPCpackage.The
instructor_rpcroute has been removed, and is replaced with theapiroutes, and theWeBWorK::ContentGenerator::InstructorRPCHandlerpackage functionality is now in theWeBWorK::ContentGenerator::APIpackage. Theapiroutes are fundamentally different than theinstructor_rpcroute. Instead of the singleinstructor_rpcroute that requires anrpc_commandparameter, the desired API command is part of the route. So, for example, instead of using thewebwork2/instructor_rpcroute with the parameterrpc_command=putUserProblemyou use the routewebwork2/api/putUserProblem. The remainder of the parameters for each command are the same as before.All of the
apiroutes are implemented in theWeBWorK::ContentGenerator::APIpackages which are basically the previousWebworkWebservicepackages. One notable difference is that each method is responsible for checking any necessary permissions required to use the route it provides. This is the same as all of the otherContentGeneratorpackages. There is a difference in the rendered JSON response for these routes. Theserver_responseandresult_datakeys are not there at all anymore. Each route can determine what it really needs to return. Before theresult_datawas really what should have just been the returned data, and theserver_responsereturn value was a useless thing to return that was never used. Note that all of the methods pass through theWeBWorK::ContentGenerator::APIbase package, and that could render a response with theerrorkey (if the user is not authenticated or the command is not found), and any of theAPImethods that provide a route can do so as well. TherenderErrormethod in the base package is a convenience for doing so. At this point allapiroutes require the user to be authenticated, but if we needapiroutes that do not require authentication (as before with theinstructor_rpcroute), that would not be hard to implement with some slight restructuring.All of webwork2's usage of these routes in JavaScript has been updated. Generally the
instructor_rpcroute is only used by webwork2, so this change should not affect anyone else.Part of the reason for this is that the
instructor_rpcroute was already not only for instructors. Students now use this route for tests to obtain the server time which ensures the remaining time displayed during a test is correct.The plan is to eventually implement a way of saving answers during tests via an api route as well.