def post(self):
     query = request.get_json()
     if query["type"] == "soknad":
         facets = convert_to_array_of_facets(query["filters"])
         soknader = self.query_soknader(facets)
         return marshal(soknader, soknadliste_fields()), 201
     abort(400, message='Unknown query type "%s"' % query["type"])
    def get(self, soknad_id=None):

        if soknad_id:
            soknad = self.get_by_id(soknad_id)
            ensure(GET, soknad)

            return marshal(soknad, soknad_fields())
        else:
            soknader = self.query_resource.query_soknader([])
            return marshal(soknader, soknadliste_fields())