check that document exists before trying to GET it