Create method to generate API resource object.