diff --git a/frontend/services/entities/autofill.ts b/frontend/services/entities/autofill.ts index c110ba3cfe..d1b49a6619 100644 --- a/frontend/services/entities/autofill.ts +++ b/frontend/services/entities/autofill.ts @@ -1,5 +1,4 @@ -// import sendRequest from "services"; -import { sendRequest } from "services/mock_service/service/service"; +import sendRequest from "services"; import endpoints from "utilities/endpoints"; export type IAutofillPolicy = { @@ -9,8 +8,11 @@ export type IAutofillPolicy = { export default { getPolicyInterpretationFromSQL: (sql: string): Promise => { - const { AUTOFILL_POLICIES } = endpoints; + const { AUTOFILL_POLICY } = endpoints; - return sendRequest("POST", AUTOFILL_POLICIES, sql); + // API expects JSON object with key "sql" + const data = JSON.stringify({ sql }); + + return sendRequest("POST", AUTOFILL_POLICY, data); }, }; diff --git a/frontend/utilities/endpoints.ts b/frontend/utilities/endpoints.ts index 941a7d6908..dd9b6afe38 100644 --- a/frontend/utilities/endpoints.ts +++ b/frontend/utilities/endpoints.ts @@ -130,7 +130,7 @@ export default { `/${API_VERSION}/fleet/software/versions/${id}`, // AI endpoints - AUTOFILL_POLICIES: `/${API_VERSION}/fleet/autofill/policies`, + AUTOFILL_POLICY: `/${API_VERSION}/fleet/autofill/policy`, SSO: `/v1/fleet/sso`, STATUS_LABEL_COUNTS: `/${API_VERSION}/fleet/host_summary`,