Good to know: All job query interfaces need to use token as the request header.
Querying job
Querying job list
POST
https://www.phoenix.global/sdk/computation/panel/jobListByUser
Query the list of jobs that the user participates in.
Request Body
200: OK Return job list
Copy {
"code" : 200 ,
"msg" : "success" ,
"size" : 20 ,
"page" : 1 ,
"totalPages" : 1 ,
"totalCount" : 2 ,
"data" : [
{
"jobID" : "23852445952590777475260973439464112207496364646998189462210436653351556571331" ,
"typeStr" : "Upload" ,
"jobName" : "matrix addition job" ,
"parties" : [
"111@gmail.com" ,
"222@gmail.com" ,
"333@gmail.com"
] ,
"contractAddr" : "0xD23C411aF00D557Bfef4390d8a1D1F2f61622130" ,
"creator" : "111@gmail.com" ,
"creationTime" : 1676518206 ,
"updateTime" : 1676518206
} ,
{
"jobID" : "3011173339614700144228046993114909367073003421675739591333024515403501305843" ,
"typeStr" : "Input" ,
"jobName" : "matrix multiplication" ,
"parties" : [
"111@gmail.com" ,
"222@gmail.com" ,
"333@gmail.com"
] ,
"contractAddr" : "0x5402e4FCd2c90A72525ff891CD4C2eC9281E62ff" ,
"creator" : "111@gmail.com" ,
"creationTime" : 1673422844 ,
"updateTime" : 1673422844
}
]
}
The usage of curl and golang sdk is as follows:
cURL Golang
Copy curl --location 'https://www.phoenix.global/sdk/computation/panel/jobListByUser' \
--header 'token: xxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"pageNo": 1,
"pageSize": 20
}'
Copy import (
"github.com/PhoenixGlobal/Phoenix-Computation-SDK/common"
"github.com/PhoenixGlobal/Phoenix-Computation-SDK/controllers"
)
func main () {
token := "xxxxxx"
reqBody := common . ReqPage {
PageNo: 1 ,
PageSize: 10 ,
}
result, err := controllers. JobListByUser (reqBody, token)
......
}
Querying job detail by job id
POST
https://www.phoenix.global/sdk/computation/panel/jobDetailByUser
Query job details according to jobid. The query user must be a participant of the job
Request Body
200: OK Return job detail
Copy {
"code" : 200 ,
"msg" : "success" ,
"jobID" : "106006086598460350897135634523568280408477446978521913351461287547366806554671" ,
"typeStr" : "Upload" ,
"jobName" : "decision tree job" ,
"parties" : [
"111@gmail.com"
] ,
"contractAddr" : "0x717c6364378D2de0032BEfD0AB5964B44691750f" ,
"creator" : "111@gmail.com" ,
"computationStr" : "decision tree" ,
"creationTime" : 1678342677 ,
"updateTime" : 1678342677 ,
"input" : "" ,
"featureData" : "titanic_x.csv" ,
"targetData" : "titanic_y.csv" ,
"testingData" : "titanic_testx.csv"
}
The usage of curl and golang sdk is as follows:
cURL Golang
Copy curl --location 'https://www.phoenix.global/sdk/computation/panel/jobDetailByUser' \
--header 'token: xxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"jobID": "xxxxxx"
}'
Copy import (
"github.com/PhoenixGlobal/Phoenix-Computation-SDK/common"
"github.com/PhoenixGlobal/Phoenix-Computation-SDK/controllers"
)
func main () {
token := "xxxxxx"
reqBody := common . ReqJobDetailByUser {
JobID: "xxxxxx" ,
}
result, err := controllers. JobDetailByUser (reqBody, token)
......
}
Querying notice list
POST
https://www.phoenix.global/sdk/computation/panel/noticeList
Query the list of jobs that require input data.
Request Body
200: OK Return job list that require input data
The usage of curl and golang sdk is as follows:
cURL Golang
Copy curl --location 'https://www.phoenix.global/sdk/computation/panel/noticeList' \
--header 'token: xxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"pageNo": 1,
"pageSize": 20
}'
Copy import (
"github.com/PhoenixGlobal/Phoenix-Computation-SDK/common"
"github.com/PhoenixGlobal/Phoenix-Computation-SDK/controllers"
)
func main () {
token := "xxxxxx"
reqBody := common . ReqPage {
PageNo: 1 ,
PageSize: 10 ,
}
result, err := controllers. NoticeList (reqBody, token)
......
}
Querying computation result of a job
POST
https://www.phoenix.global/sdk/computation/panel/subListByUser
The computation results will be submitted to the blockchain through smart contracts. You can query the results submitted to the chain by this api. All participants can submit their calculation results to the blockchain.
Request Body
200: OK Return the computation result submitted to the phoenix blockchain
Copy {
"code" : 200 ,
"msg" : "success" ,
"size" : 20 ,
"page" : 1 ,
"totalPages" : 1 ,
"totalCount" : 3 ,
"trainModel" : "" ,
"testingResult" : "" ,
"data" : [
{
"txHash" : "0xea89d05654be3009ebe61fe163347afbf40a053ecc641b2fc075347b7d6020eb" ,
"submitValue" : "[[b'5.000000' b'8.199982']\n [b'-15.000000' b'12.000000']\n [b'3.000000' b'6.000000']]" ,
"submitTime" : 1673407741 ,
"ccdUsage" : "0.018"
} ,
{
"txHash" : "0xab3df69787c634ab29bb784e00e59e017806683ee74667f4b9e340c66906c6cd" ,
"submitValue" : "[[b'5.000000' b'8.199982']\n [b'-15.000000' b'12.000000']\n [b'3.000000' b'6.000000']]" ,
"submitTime" : 1673407740 ,
"ccdUsage" : "0.018"
} ,
{
"txHash" : "0xce311949f53579056cf69b151a342245a019c3f0450ea209e139fafa908d3d1e" ,
"submitValue" : "[[b'5.000000' b'8.199982']\n [b'-15.000000' b'12.000000']\n [b'3.000000' b'6.000000']]" ,
"submitTime" : 1673407740 ,
"ccdUsage" : "0.018"
}
]
}
The usage of curl and golang sdk is as follows:
cURL Golang
Copy curl --location 'https://www.phoenix.global/sdk/computation/panel/subListByUser' \
--header 'token: xxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"pageNo": 1,
"pageSize": 20,
"jobID": "xxxxxx"
}'
Copy import (
"github.com/PhoenixGlobal/Phoenix-Computation-SDK/common"
"github.com/PhoenixGlobal/Phoenix-Computation-SDK/controllers"
)
func main () {
token := "xxxxxx"
reqPage := common . ReqPage {
PageNo: 1 ,
PageSize: 10 ,
}
reqBody := common . ReqSubListByUser {
ReqPage: & reqPage,
JobID: "xxxxxx" ,
}
result, err := controllers. SubmissionList (reqBody, token)
......
}
Querying CCD usage
POST
https://www.phoenix.global/sdk/computation/panel/ccdUsageList
Query the details of the CCD consumption of the account.
Request Body
200: OK Return CCD usage list
Copy {
"code" : 200 ,
"msg" : "success" ,
"size" : 20 ,
"page" : 1 ,
"totalPages" : 1 ,
"totalCount" : 2 ,
"data" : [
{
"jobID" : "67359335745793195679188745481165227472100204117487131087027292513447780097380" ,
"type" : "Upload" ,
"jobName" : "logistic regression job" ,
"creator" : "111@gmail.com" ,
"creationTime" : 1677490079 ,
"updateTime" : 1677490079 ,
"ccdUsage" : "0.003521" ,
"contractAddr" : "0x234f698c47ff3B6DC05DC2f9F1a357f2f6Dcda16"
} ,
{
"jobID" : "92660823194349043075443300863708415242102090291282612538954225036265610510681" ,
"type" : "Upload" ,
"jobName" : "decision tree job" ,
"creator" : "111@gmail.com" ,
"creationTime" : 1677489985 ,
"updateTime" : 1677489985 ,
"ccdUsage" : "0.011765" ,
"contractAddr" : "0x717c6364378D2de0032BEfD0AB5964B44691750f"
}
]
}
The usage of curl and golang sdk is as follows:
cURL Golang
Copy curl --location 'https://www.phoenix.global/sdk/computation/panel/ccdUsageList' \
--header 'token: xxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"pageNo": 1,
"pageSize": 20
}'
Copy import (
"github.com/PhoenixGlobal/Phoenix-Computation-SDK/common"
"github.com/PhoenixGlobal/Phoenix-Computation-SDK/controllers"
)
func main () {
token := "xxxxxx"
reqBody := common . ReqPage {
PageNo: 1 ,
PageSize: 10 ,
}
result, err := controllers. CcdUsageList (reqBody, token)
......
}
Downloading uploaded dataset
GET
https://www.phoenix.global/sdk/computation/panel/downloadDataset
Download the dataset of the upload job. Only the creator of the upload job can successfully call this api.
Query Parameters
The usage of curl and golang sdk is as follows:
cURL Golang
Copy curl --location 'https://www.phoenix.global/sdk/computation/panel/downloadDataset?datasetType=target&jobID=xxxxxx' \
--header 'token: xxxxxx'
Copy import (
"github.com/PhoenixGlobal/Phoenix-Computation-SDK/common"
"github.com/PhoenixGlobal/Phoenix-Computation-SDK/controllers"
)
func main () {
token := "xxxxxx"
reqBody := common . ReqDownloadDataset {
JobID: "xxxxxx" ,
DatasetType: "target" ,
}
result, err := controllers. DownloadDataset (reqBody, token)
......
}