{"record":{"id":"f7d567ba54f5022e","repo":"Semantic-Org/Semantic-UI","slug":"missing-a-required-url-parameter","errorCode":null,"errorMessage":"Missing a required URL parameter: ","messagePattern":"Missing a required URL parameter: ","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/definitions/behaviors/api.js","lineNumber":1139,"sourceCode":"  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'\n  },\n\n  selector: {\n    disabled : '.disabled',\n    form      : 'form'\n  },","sourceCodeStart":1121,"sourceCodeEnd":1157,"githubUrl":"https://github.com/Semantic-Org/Semantic-UI/blob/597843ab84d565cccfd8fd7719416350ae73e734/src/definitions/behaviors/api.js#L1121-L1157","documentation":"This error is logged by the API module's add.urlData() function (api.js:372-374) when a URL template contains a required variable (e.g., '/users/{$id}') that cannot be resolved to a value. The function searches urlData, element data ($module.data), and context data ($context.data) for each required variable; if none is found, it logs this error with the variable name and returns false, aborting the request.","triggerScenarios":"Configuring url: '/api/users/{$id}' but not providing id in settings.urlData, on the element via data-id, or on the context element via data-id. Also when the variable name in the template does not match the key provided in urlData (case sensitivity, typos).","commonSituations":"Dynamic elements where the data attribute is populated asynchronously and the API call fires before it is set. URL templates with variable names that don't match urlData keys. Forgetting to pass urlData in settings. Variable names containing special characters or being deeply nested.","solutions":["Provide the required variable in settings.urlData: $('.el').api({ url: '/users/{$id}', urlData: { id: 42 } }).","Set the variable as a data attribute on the element: <button data-id='42' class='ui button'>.","Set the variable on the context element (usually the closest form or container with data-context).","If the variable is genuinely optional, use the optional syntax {/var} instead of {var}."],"exampleFix":"// before\n$('.user-btn').api({\n  url: '/api/users/{$id}'\n  // no id provided anywhere\n});\n\n// after\n$('.user-btn').api({\n  url: '/api/users/{$id}',\n  urlData: { id: getUserId() }\n});","handlingStrategy":"validation","validationCode":"// Validate required URL parameters are present before the request\nfunction resolveUrl(url, urlData, $module, $context) {\n  var required = url.match(/\\{\\$?[A-Za-z0-9]+\\}/g) || [];\n  var missing = required.filter(function(tok) {\n    var key = tok.replace(/[\\{\\}\\$]/g, '');\n    return urlData[key] === undefined && $module.data(key) === undefined && ($context ? $context.data(key) : undefined) === undefined;\n  });\n  if (missing.length) {\n    console.error('Missing required URL parameters:', missing);\n    return false;\n  }\n  return url;\n}","typeGuard":"// Check if all required URL template variables have values\nfunction hasAllRequiredParams(url, urlData, $module) {\n  var required = url.match(/\\{[A-Za-z0-9]+\\}/g) || [];\n  return required.every(function(tok) {\n    var key = tok.replace(/[\\{\\}\\$]/g, '');\n    return urlData[key] !== undefined || $module.data(key) !== undefined;\n  });\n}","tryCatchPattern":null,"preventionTips":["Provide all required URL variables in settings.urlData.","Set required variables as data attributes on the element or context.","Use the optional variable syntax {/var} for non-required parameters."],"tags":["api","url-template","missing-parameter","configuration","semantic-ui"],"backgroundTag":null,"analyzedSha":"597843ab84d565cccfd8fd7719416350ae73e734","analyzedAt":"2026-08-13T01:44:23.827Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}