PALANTIR Library
The PALANTIR Library is an importable library containing functions to connect, authenticate, and interact with Palantir’s Foundry and interacts with the Ontology layer. This library is used in the Palantir Adapter.
Require Modules
When imported into projects, typically only the PALANTIRclient and PALANTIRhelpers module needs to be required in order to create the client and access the API methods.
local Client = require 'PALANTIR.PALANTIRclient'
local Helpers = require 'PALANTIR.PALANTIRhelpers'Construct the client
To get the PALANTIR client, you will need to supply: baseURL, accessToken, and ontologyAPIName.
local C = component.fields()
local pal = PALANTIRclient{
baseUrl = C.baseURL, -- e.g. https://healthit.usw-23.palantirfoundry.com/
accessToken = C.accessToken, -- Bearer token
ontologyApiName = C.ontologyAPIName -- e.g. ontology-xxxx
}Calling Methods
To make PALANTIR API calls like GET, MODIFY, DELETE, SEARCH, you will need to use PALANTIR client object to discoverable API function calls:
pal:search{...}
Search instances of an object type.
Args:
objectTypeApiName(string, required),where,select,pageSize,pageToken,liveNote: We do not send
orderBy(some tenants require JSON sorter format). Keep it simple.
pal:get{...}
Read one object by primary key.
Args:
objectTypeApiName(string),primaryKey(string),select,live
pal:create{...}
Create an object instance.
Args:
objectTypeApiName,parameters(table),live
pal:apply{...}
Apply an action to an object.
Args:
actionApiName(string),parameters(table),liveTip: Use
Helpers.objectRefParamName(pal, actionApiName)to get the correct object-reference parameter name to pair with your primary key.
pal:custom{...}
Low-level HTTP funnel (mirrors EPIC’s custom).
Args:
method,api,parameters(table),liveUse: When you need a direct call outside the convenience methods above.
-- Search
local ok, res = pal:search{
objectTypeApiName = 'ExampleRouteAlert',
select = { 'id','title','status','priority' },
pageSize = 5,
live = true
}
-- Get by primary key
local okGet, alert = pal:get{
objectTypeApiName = 'ExampleRouteAlert',
primaryKey = 'abc-123',
select = { 'id','title','status' },
live = true
}Files and Folder Review
PALANTIRclient.lua
Creates thepalobject; attaches methods; registers inline help (help.map).
Also preloadsobjectTypes,actionsMap,actionsByApifor convenience.PALANTIRbuilder.lua
Encapsulates one-time ontology metadata loading and makes it easy to keepPALANTIRclient.luasmall/clean.PALANTIRhttp.lua
Centralizes HTTP and JSON; keeps method modules tiny and testable.PALANTIRhelpers.lua
Non-essential helpers used by examples (e.g., discovering the correct object reference parameter for an action).methods/
Each file exports exactly one EPIC-style function, mounted underpal:.
These are the only things you see in auto-complete:search,get,create,apply,custom.help/
JSON help documents (one per method + the constructor), following Iguana’s help format.
This is what powers the in-IDE hints when you typepal:.