Json api stuff mostly done