As for matching the expected voltage, search for "When your input isn't 0 to 3.3V but e.g 0 to 5V, use an input voltage divider..." here in this thread. Notice how the ratio of the two resistors is essentially 1:2. Analysis: 1+2=3 and 2/3 of 5V is 3.33V so that's how that works for toggling a 3.3V input from a 5V signal.
Assuming that you could attach that "voltage divider" correctly to a pin on your Raspberry, the next step would be to do something when the pin reads high.
As for the movement, that depends. Print jobs can be in one of two modes: absolute or relative movement. If your print job happens to be in the relative mode, then moving 76 mm to the right (~3") is then accomplished by something that runs the corresponding gcode to do so.
The thing which talks to the REST API then is in question. It could be a plugin. It could be a separate service. It could be a command line program in Python, NodeJS, bash or go. There are many ways of talking to an API like this. There may be ways within the existing plugin space that I'm forgetting. I want to say that the Gcode System Commands plugin could be useful here.