refactor code: get POST query 2