Added write method to api