Orange
Search…
⌃K

Get Campaign Info using API

Orange provides open APIs implemented using the GraphQL protocol to allow you to get campaign information.
When sending requests, you need to include an URL, which is represented in the doc withhttp://<api-endpoint>/query. To obtain the actual URL, please contact us using Discord or Twitter.

Method List

Method Name
Description
Gets campaign details by the ID of the relevant NFT
Gets campaign details by the campaign ID
Gets campaign details by the name of the campaign owner

getOrangeByNFTTokenID

Gets campaign details by the ID of the relevant NFT.

Parameters

Name
Type
Description
tokenID
Int
NFT token ID
chain
String
chain name (e.g. eth, polygon, bsc)

Returns

type GetOrangeByNFTTokenIDResp{
campaignInfo:OrangeCampaignItem!
nftInfos:NFTINfo!
claimTime:Int!
owner:Participant!
}
To view the full list of variables, please refer to Structure of Data in Returns.
GraphQL Schema
query{
getOrangeByNFTTokenID(tokenID:53,chain:"polygon"){
campaignInfo{campaignID,campaignURL,campaignName,campaignHost,campaignStartTime,campaignEndTime,tasks{taskTitle,isReputationTask,reputationItem{DatasetName,
DatasetProvider,DatasetDescription,DatasetTotalUses,DatasetCreateTime,DatasetStatus,
Datasources,ModelName,ModelProvider,ModelDescription,ModelTotalUses,ModelCreateTime,
ModelStatus,ModelType,ModelLowestScore,ModelHighestScore,EligibleLevelToClaim
}}},
nftInfos{chain,nftContractAddress},
claimTime,
owner{walletAddress,did}
}
}

Examples

Golang
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "http://<api-endpoint>/query"
method := "POST"
payload := strings.NewReader("{\"query\":\"query{\\n getOrangeByNFTTokenID(tokenID:53,chain:\\\"polygon\\\"){\\n campaignInfo{campaignID,campaignURL,campaignName,campaignHost,campaignStartTime,campaignEndTime,tasks{taskTitle,isReputationTask,reputationItem{DatasetName,\\n DatasetProvider,DatasetDescription,DatasetTotalUses,DatasetCreateTime,DatasetStatus,\\n Datasources,ModelName,ModelProvider,ModelDescription,ModelTotalUses,ModelCreateTime,\\n ModelStatus,ModelType,ModelLowestScore,ModelHighestScore,EligibleLevelToClaim\\n }}},\\n nftInfos{chain,nftContractAddress},\\n claimTime,\\n owner{walletAddress,did}\\n }\\n}\",\"variables\":{}}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"query\":\"query{\\n getOrangeByNFTTokenID(tokenID:53,chain:\\\"polygon\\\"){\\n campaignInfo{campaignID,campaignURL,campaignName,campaignHost,campaignStartTime,campaignEndTime,tasks{taskTitle,isReputationTask,reputationItem{DatasetName,\\n DatasetProvider,DatasetDescription,DatasetTotalUses,DatasetCreateTime,DatasetStatus,\\n Datasources,ModelName,ModelProvider,ModelDescription,ModelTotalUses,ModelCreateTime,\\n ModelStatus,ModelType,ModelLowestScore,ModelHighestScore,EligibleLevelToClaim\\n }}},\\n nftInfos{chain,nftContractAddress},\\n claimTime,\\n owner{walletAddress,did}\\n }\\n}\",\"variables\":{}}");
Request request = new Request.Builder()
.url("http://<api-endpoint>/query")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
JavaScript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var graphql = JSON.stringify({
query: "query{\n getOrangeByNFTTokenID(tokenID:53,chain:\"polygon\"){\n campaignInfo{campaignID,campaignURL,campaignName,campaignHost,campaignStartTime,campaignEndTime,tasks{taskTitle,isReputationTask,reputationItem{DatasetName,\n DatasetProvider,DatasetDescription,DatasetTotalUses,DatasetCreateTime,DatasetStatus,\n Datasources,ModelName,ModelProvider,ModelDescription,ModelTotalUses,ModelCreateTime,\n ModelStatus,ModelType,ModelLowestScore,ModelHighestScore,EligibleLevelToClaim\n }}},\n nftInfos{chain,nftContractAddress},\n claimTime,\n owner{walletAddress,did}\n }\n}",
variables: {}
})
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: graphql,
redirect: 'follow'
};
fetch("http://<api-endpoint>/query", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

getOrangeByCampaignID

Gets campaign details by the campaign ID.

Parameters

Name
Type
Description
campaignID
Int
campaign ID

Returns

type GetOrangeByCampaignIDResp{
campaignInfo:OrangeCampaignItem!
participants:[Participants!]!
nftInfos:[NFTINfo!]!
}
To view the full list of variables, please refer to Structure of Data in Returns.

GraphQL Schema

query{
getOrangeByCampaignID(campaignID:52){
campaignInfo{campaignID,campaignURL,campaignName,campaignHost,campaignStartTime,campaignEndTime,tasks{taskTitle,isReputationTask,reputationItem{DatasetName,
DatasetProvider,DatasetDescription,DatasetTotalUses,DatasetCreateTime,DatasetStatus,
Datasources,ModelName,ModelProvider,ModelDescription,ModelTotalUses,ModelCreateTime,
ModelStatus,ModelType,ModelLowestScore,ModelHighestScore,EligibleLevelToClaim
}}},
participants{chain,totalNumber,details{walletAddress,did}},
nftInfos{chain,nftContractAddress}
}
}

Examples

Golong
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "http://<api-endpoint>/query"
method := "POST"
payload := strings.NewReader("{\"query\":\"query{\\n getOrangeByCampaignID(campaignID:52){\\n campaignInfo{campaignID,campaignURL,campaignName,campaignHost,campaignStartTime,campaignEndTime,tasks{taskTitle,isReputationTask,reputationItem{DatasetName,\\n DatasetProvider,DatasetDescription,DatasetTotalUses,DatasetCreateTime,DatasetStatus,\\n Datasources,ModelName,ModelProvider,ModelDescription,ModelTotalUses,ModelCreateTime,\\n ModelStatus,ModelType,ModelLowestScore,ModelHighestScore,EligibleLevelToClaim\\n }}},\\n participants{chain,totalNumber,details{walletAddress,did}},\\n nftInfos{chain,nftContractAddress}\\n }\\n}\",\"variables\":{}}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}

Java

OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"query\":\"query{\\n getOrangeByCampaignID(campaignID:52){\\n campaignInfo{campaignID,campaignURL,campaignName,campaignHost,campaignStartTime,campaignEndTime,tasks{taskTitle,isReputationTask,reputationItem{DatasetName,\\n DatasetProvider,DatasetDescription,DatasetTotalUses,DatasetCreateTime,DatasetStatus,\\n Datasources,ModelName,ModelProvider,ModelDescription,ModelTotalUses,ModelCreateTime,\\n ModelStatus,ModelType,ModelLowestScore,ModelHighestScore,EligibleLevelToClaim\\n }}},\\n participants{chain,totalNumber,details{walletAddress,did}},\\n nftInfos{chain,nftContractAddress}\\n }\\n}\",\"variables\":{}}");
Request request = new Request.Builder()
.url("http://<api-endpoint>/query")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
JavaScript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var graphql = JSON.stringify({
query: "query{\n getOrangeByCampaignID(campaignID:52){\n campaignInfo{campaignID,campaignURL,campaignName,campaignHost,campaignStartTime,campaignEndTime,tasks{taskTitle,isReputationTask,reputationItem{DatasetName,\n DatasetProvider,DatasetDescription,DatasetTotalUses,DatasetCreateTime,DatasetStatus,\n Datasources,ModelName,ModelProvider,ModelDescription,ModelTotalUses,ModelCreateTime,\n ModelStatus,ModelType,ModelLowestScore,ModelHighestScore,EligibleLevelToClaim\n }}},\n participants{chain,totalNumber,details{walletAddress,did}},\n nftInfos{chain,nftContractAddress}\n }\n}",
variables: {}
})
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: graphql,
redirect: 'follow'
};
fetch("http://<api-endpoint>/query", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

getOrangeByCampaignHostName

Gets campaign details by the name of the campaign owner.

Parameters

Name
Type
Description
name
String
name of the campaign host

Returns

type GetOrangeByCampaignHostNameResp{
campaignInfos:[OrangeCampaignItem!]!
}
To view the full list of variables, please refer to Structure of Data in Returns.

GraphQL Schema

query{
getOrangeByCampaignHostName(name:"Dework"){
campaignInfos{campaignID,campaignURL,campaignName,campaignHost,campaignStartTime,campaignEndTime}
}
}

Examples

Golong
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "http://<api-endpoint>/query"
method := "POST"
payload := strings.NewReader("{\"query\":\"query{\\n getOrangeByCampaignHostName(name:\\\"Dework\\\"){\\n campaignInfos{campaignID,campaignURL,campaignName,campaignHost,campaignStartTime,campaignEndTime}\\n }\\n}\",\"variables\":{}}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"query\":\"query{\\n getOrangeByCampaignHostName(name:\\\"Dework\\\"){\\n campaignInfos{campaignID,campaignURL,campaignName,campaignHost,campaignStartTime,campaignEndTime}\\n }\\n}\",\"variables\":{}}");
Request request = new Request.Builder()
.url("http://<api-endpoint>/query")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
JavaScript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var graphql = JSON.stringify({
query: "query{\n getOrangeByCampaignHostName(name:\"Dework\"){\n campaignInfos{campaignID,campaignURL,campaignName,campaignHost,campaignStartTime,campaignEndTime}\n }\n}",
variables: {}
})
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: graphql,
redirect: 'follow'
};
fetch("http://<api-endpoint>/query", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Structure of Data in Returns

CampaignItem

type OrangeCampaignItem{
campaignID:Int! // unique campaign ID
campaignURL:String! // URL of the campaign
campaignName:String!
campaignHost:String! // Owner of the campaign
campaignStartTime:Int! // Unix timestamp
campaignEndTime:Int! // Unix timestamp
tasks:[OrangeTaskItem!]! // campaign tasks
}

TaskItem

type OrangeTaskItem{
taskTitle:String! // task title
isReputationTask:Boolean! // if the task requires to invoke a reputation model
reputationItem:OrangeReputation // if yes, returns task details as listed below
}
type OrangeReputation{
DatasetName:String!
DatasetProvider:String!
DatasetDescription:String!
DatasetTotalUses:Int!
DatasetCreateTime:Int!
DatasetStatus:String!
Datasources:String!
ModelName:String!
ModelProvider:String!
ModelDescription:String!
ModelTotalUses:Int!
ModelCreateTime:Int!
ModelStatus:String!
ModelType:String!
ModelLowestScore:Int!
ModelHighestScore:Int!
EligibleLevelToClaim:Int!
}

Participant

type Participants{
chain:String!
totalNumber:Int!
details:[Participant!]!
}
type Participant{
walletAddress:String! // participant's wallet address
did:String! // participant's DID
}

NFTINfo

type NFTINfo{
chain:String!
nftContractAddress:String!
}