The AppID, available from sprintr is used in the build api e.g.
The projectid is used in the stories api e.g.
See https://docs.mendix.com/apidocs-mxsdk/apidocs/
As far as I can determine there is no way to retrieve the AppID from java and the projectid is not available from the sprinter platform (this is an internally used id).