API Reference
Call a function
POST
/v0/collections/{collection_path}/records/{record_id}/call/{function_name}
collection_path*
record_id*
function_name*
curl --request POST \
--url https://testnet.polybase.xyz/v0/collections/polybase%2Fcore%2Fusers/records/id123/call/functionName\
--header 'Accept: application/json'
-d '{ "args": ["Polybase"] }'
# optional (if supplied ctx.publicKey will be populated)
--header 'X-Polybase-Signature: v=0,t=1671884992,h=eth-personal-sign,sig=0x288db6271d92253ae19983a8e5110f1bc1bef1911210127ccbf657d85428ba9917aa9457f0f8e7f300a36b106525d3a3471e63ae265af4898742040a377e1da11c'
Path Params
collection_pathrequired
string
The path to the collection holding the record. This must be URL encoded, so a collection path of polybase/core/users
would be requested as polybase%2Fcore%2Fusers
.
record_idrequired
string
A unique identifier for the record, as defined by the collection constructor
function.
function_namerequired
string
The name of the function that is defined on the collection that should be called.
Body Params
argsrequired
array
An array of arguments that should be passed to the the function being called on the collection, as defined in the collection schema.
For example, if the collection schema is as follows:
collection Users {
id: string;
name: string;
constructor (name: string) {
this.id = PublicKey;
this.name = name;
}
setName(name: string) {
this.name = name;
}
}
The args would be:
{
args: [
// This is the 1st parameter name: string
"Polybase"
]
}
curl --request POST \
--url https://testnet.polybase.xyz/v0/collections/polybase%2Fcore%2Fusers/records/id123/call/functionName\
--header 'Accept: application/json'
-d '{ "args": ["Polybase"] }'
# optional (if supplied ctx.publicKey will be populated)
--header 'X-Polybase-Signature: v=0,t=1671884992,h=eth-personal-sign,sig=0x288db6271d92253ae19983a8e5110f1bc1bef1911210127ccbf657d85428ba9917aa9457f0f8e7f300a36b106525d3a3471e63ae265af4898742040a377e1da11c'