Server for the API of the Southern African Large Telescope (SALT)
# Welcome to SALT API Server
A server for the API of the Southern African Large Telescope (SALT). This is currently geared towards investigators who might want to check their proposal's progress, (re)submit proposal content, and put observing blocks on and off hold.
This is work in progress, and not all functionality is in place yet.
## Using the API
The following assumes that the API is available at `
localhost`. Replace this with the correct URL when using any of the queries below.
### GraphQL
API queries are made with GraphQL.
### Viewing the API
GraphiQL is enabled on the server, allowing you to view the API by pointing your browsewr to `
saltapi`.
### Authentication
Authentication is required for using (most of) the API. You authenticate by including an `Authorization` header with a valid authentication token with your HTTP request. For example:
```
Authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0fQ.Lst7gMf9G2j1FCBCMIDSq3TGF00JnjtAvGA6m-FsmRg
```
You can request a token with a GraphQL query.
```graphql
query {
authToken(username: "frodo", password: "secret") {
token
}
}
```
As a curl request:
```bash
curl '
localhost' -H 'Content-Type: application/json' -H 'Accept: application/json' --data-binary '{"query":"query {\n authToken(username: \"frodo\", password: \"secret\") {\n token\n }\n}\n"}'
```
### Observations for a proposal
The following query returns the observations done for proposal 2018-1-SCI-042.
```graphql
query {
proposal(proposalCode: "2018-1-SCI-008") {
observations {
night
status
}
}
}
```
As a curl request:
```bash
curl '
localhost' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0fQ.Lst7gMf9G2j1FCBCMIDSq3TGF00JnjtAvGA6m-FsmRg' --data-binary '{"query":"query {\n proposal(proposalCode: \"2018-1-SCI-008\") {\n observations {\n night\n …