added xapi_request function