Reimplementation of lfapi with pgrest