add the fetch resource function