When using the new means of defining an API as described here:
Can I create 1 script that contains all the endpoints (methods) I need?
Yes you can.
In the same section of the docs you linked, you can find some examples (https://docs.dataminer.services/user-guide/Advanced_Modules/UserDefinedAPIs/Defining_an_API/UD_APIs_Examples.html).
For your case, you can add conditions to your script that check on the requestData.Route and the requestData.RequestMethod.
Do note that only GET, PUT, POST & DELETE are support currently for the RequestMethod.