Skip to content
This page View Markdown Open in ChatGPT Open in Claude

Is valid data for third party API

Runs the request schema declared by a third party API (a deprecated feature) on some data and answers the errors, without calling the API.

Method POST
URL /api/system-api/admin/is-valid-data-for-third-party-api : admin is the user path of your account
Body { apiBundleName, apiVersionName, name, type, data, isArray? } or an array of them
Answer data : an array of errors (empty when valid), or an array of arrays
From code g.sys.system.isValidDataForThirdPartyAPI

The call

Body
{ "apiBundleName": "bundle_name", "apiVersionName": "api_version", "name": "api_name", "type": "BODY", "data": { "name": "Bob", "mobile": 1234567890 } }
Body : several, one on query params
[
    { "apiBundleName": "bundle_name", "apiVersionName": "api_version", "name": "api_name", "type": "BODY", "data": { "name": "Bob" } },
    { "apiBundleName": "bundle_name", "apiVersionName": "api_version", "name": "api_name", "type": "QUERY_PARAMS", "data": { "size": 123456 } }
]
Answer
{ "success": true, "statusCode": 200, "data": [ { "type": "required", "field": "mobile", "message": "Please provide valid 'mobile' field with type 'number'.", "code": 400 } ] }
  • type is BODY or QUERY_PARAMS ; isArray: true when the API expects an array body.

Access and settings

  • Over HTTP, a system API answers once its settings give it apiAccessType: TOKEN_ACCESS (the token of an API user whose group grants this system API, in x-am-authorization) or IS_PUBLIC. Without settings it is NO_ACCESS : your code calls it through g.sys, the admin panel tests it, and an HTTP call is refused.
  • The settings can also cache the answer or require person tokens (authProviders) ; pre and post hooks run around it like around any API.
  • The request headers apply : x-am-response-case, x-am-content-type-response, x-am-internationalization, x-am-tenant-username…

Errors

Code When
400 The body is wrong : the message names the missing or invalid key.
401 No valid API user token, or the API is NO_ACCESS : You are not authorized to access this API.
403 No group grants this system API.