Added new upsert method to api_post