{"record":{"id":"abe40b8c27c99d08","repo":"Semantic-Org/Semantic-UI","slug":"api-action-used-but-no-url-was-defined","errorCode":null,"errorMessage":"API action used but no url was defined","messagePattern":"API action used but no url was defined","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/definitions/behaviors/api.js","lineNumber":1133,"sourceCode":"  onFailure   : function(response, $module) {},\n\n  // server error\n  onError     : function(errorMessage, $module) {},\n\n  // request aborted\n  onAbort     : function(errorMessage, $module) {},\n\n  successTest : false,\n\n  // errors\n  error : {\n    beforeSend        : 'The before send function has aborted the request',\n    error             : 'There was an error with your request',\n    exitConditions    : 'API Request Aborted. Exit conditions met',\n    JSONParse         : 'JSON could not be parsed during error handling',\n    legacyParameters  : 'You are using legacy API success callback names',\n    method            : 'The method you called is not defined',\n    missingAction     : 'API action used but no url was defined',\n    missingSerialize  : 'jquery-serialize-object is required to add form data to an existing data object',\n    missingURL        : 'No URL specified for api event',\n    noReturnedValue   : 'The beforeSend callback must return a settings object, beforeSend ignored.',\n    noStorage         : 'Caching responses locally requires session storage',\n    parseError        : 'There was an error parsing your request',\n    requiredParameter : 'Missing a required URL parameter: ',\n    statusMessage     : 'Server gave an error: ',\n    timeout           : 'Your request timed out'\n  },\n\n  regExp  : {\n    required : /\\{\\$*[A-z0-9]+\\}/g,\n    optional : /\\{\\/\\$*[A-z0-9]+\\}/g,\n  },\n\n  className: {\n    loading : 'loading',\n    error   : 'error'","sourceCodeStart":1115,"sourceCodeEnd":1151,"githubUrl":"https://github.com/Semantic-Org/Semantic-UI/blob/597843ab84d565cccfd8fd7719416350ae73e734/src/definitions/behaviors/api.js#L1115-L1151","documentation":"This error is logged by the API module's get.templatedURL() function (api.js:804-824) when settings.action is specified (meaning the developer intends to use a named API endpoint from the settings.api map), but settings.api[action] is undefined. The module looks up the URL from the api configuration object by action name; if no entry exists for that action, it cannot determine the request URL and logs this error.","triggerScenarios":"Configuring $('.el').api({ action: 'get user' }) without providing a corresponding entry in the api settings map ($.fn.api.settings.api['get user'] = '/users/{id}'). Also when the action name has a typo or mismatch in spacing/casing between the action property and the api map key.","commonSituations":"Defining API endpoints globally via $.fn.api.settings.api but forgetting an entry. Action names with inconsistent casing or extra spaces. Using data-api attributes that reference an action not defined in the api map. Migrating from URL-based to action-based configuration and missing entries.","solutions":["Add the missing action to the api settings map: $.fn.api.settings.api['your action'] = '/your/url'.","Ensure the action name in settings.action exactly matches the key in settings.api (including spaces and case).","Alternatively, provide settings.url directly instead of relying on action-based URL lookup."],"exampleFix":"// before\n$('.user-btn').api({\n  action: 'get user'\n  // no api map entry for 'get user'\n});\n\n// after\n$.fn.api.settings.api['get user'] = '/users/{$id}';\n$('.user-btn').api({\n  action: 'get user',\n  urlData: { id: 42 }\n});","handlingStrategy":"validation","validationCode":"// Validate the action exists in the api map before using it\nvar actionName = 'get user';\nif ($.fn.api.settings.api[actionName] !== undefined) {\n  $('.el').api({ action: actionName });\n} else {\n  console.error('Action not defined in api map:', actionName);\n  // Fallback to direct URL\n  $('.el').api({ url: '/users/' + userId });\n}","typeGuard":"// Check if an action is registered in the api map\nfunction isActionDefined(action) {\n  return $.fn.api && $.fn.api.settings && $.fn.api.settings.api && $.fn.api.settings.api[action] !== undefined;\n}","tryCatchPattern":null,"preventionTips":["Define all API actions in a central configuration block at app initialization.","Use consistent naming for actions (e.g., lowercase with spaces).","Provide a direct url fallback when an action is not found."],"tags":["api","action","missing-url","configuration","semantic-ui"],"backgroundTag":null,"analyzedSha":"597843ab84d565cccfd8fd7719416350ae73e734","analyzedAt":"2026-08-13T01:44:23.827Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}