finished JSON API and added published and unpublished methods