This API can query most of information needed by the TAC statistics page, more query
fields will be added as they are needed by the TAC Process or any other application that might need to use
it.
Some Query fields might change in time to best fit what will be confirmed as effective by
anyone or any application using it and not affecting any application that is already using this API.
Please refer to official website for more
{"usename": "WMUser",
"password":"password"}to get a user Token which need to be included as a header in all queries
to API. header name:- Authorization: Token user token.
Docs button at top right of the screen.A graphQL query is like defining a structure of your json object.
Querying for number of visits, ra and dec for 2017-1 targets.
|
1
2
3
4
5
6
7
8
9
10
11
|
{ targets(semester: "2017-1"){ NVisits target{ targetcoordinates{ ra dec } } } } |
Target field where there is a link to target Coordinates field
where there are RA and DEC of that target To avoid Line 4-7 the auto mapping of the SDB don't have to map everything
{
"data": {
"targets": [
{
"NVisits": 1,
"target": {
"targetcoordinates": {
"dec": x.x,
"ra": x.x
}
}
},
{
"NVisits": 2,
"target": {
"targetcoordinates": {
"dec": x.x,
"ra": x.x
}
}
},
.
.
.
Query this will lead you to what you can query in a
root field.
Docs for Documentation Explorer Query to root query, targets(semester: String): [ProposalTarget]("semester: String") which means
you must provide a semester of type string when you are querying for
targets
"[ProposalTarget]" square brackets means you will get a list of
what is defined within it, in this case you will get a list of
ProposalTarget
ProposalTarget to see what fields it contains. ProposalTarget is of interest, which is NVisits of type INT.
It is then added to the query
target: Target Field in
target >> targetcoordinates >> ra and dec which are float
http://tacapi.cape.saao.ac.za/graphiql?query={targets(semester: "2017-1"){NVisits target{targetcoordinates{ra dec}}}}
the results of the above query will either be errors or data.
errors
will have massage field that explains what kind of error it is or where the error
is happening
data the results from a successful query.