Commit 23ff0439 authored by Chelsea Gille's avatar Chelsea Gille
Browse files

Add STAR support file with Banner Messages support task

parent 41e80c51
Loading
Loading
Loading
Loading

star/Support.md

0 → 100644
+58 −0
Original line number Diff line number Diff line
# Common STAR Support Tasks
[[_TOC_]]

## STAR Banner Messages
The STAR API has a `messages` endpoint that can be used to create, update, and delete banner messages that display globally to all users who log into STAR.

A message has the following properties:

`displayStart`: epoch timestamp in milliseconds for the local time that the banner should start being displayed. (You can use a tool like [this](https://www.epochconverter.com/) to generate the correct timestamp.)
`displayEnd`: epoch timestamp in milliseconds for the local time that the banner should stop being displayed. (You can use a tool like [this](https://www.epochconverter.com/) to generate the correct timestamp.)
`text`: string for the message that can include html elements. e.g. `<a>` tags and formatting tags like `<strong>`. Make sure quotes are escaped appropriately within the text.
`level`: corresponds to the color of the banner. Possible values: `info` = light blue, `warn` = yellow, `error` = red
`id`: the autogenerated id for the message

*Note:* Requests must be sent using basic authentication for the api user and the `On-Behalf-Of` header set to the NetID of the admin user sending the request. 

### Example Requests using TEST URL & curl
GET (use this to get the ID of messages you want to update/delete)
```
curl -u apiusername -v \
--header "Content-Type: application/json" \
--header "On-Behalf-Of: mynetid" \
-XGET “http://service:service@localhost:8080/api/v2/messages/id”
```

CREATE
```
curl -u apiusername -v \
--header "Content-Type: application/json" \
--header "On-Behalf-Of: mynetid" \
-X POST "https://test.star.doit.wisc.edu/api/v2/messages" \
--data '{ \
    "text": "<strong>Welcome to STAR!</strong>  Report your time <a href=\"https://my.wisc.edu/star\" target=\"_blank\">here</a>.", \
    "level": "info", \
    "displayStart": 1609480800000, \
    "displayEnd": 1614578400000 \
}' 
```  

UPDATE (PUT will replace the entire message object, PATCH will update a subset of the message object)
```
curl -u apiusername -v \
--header "Content-Type: application/json" \
--header "On-Behalf-Of: mynetid" \
-XPATCH “https://test.star.doit.wisc.edu/api/v2/messages/1234-abcdefg-hijklmno-pqrstuv” \
—data '{"text": "Welcome!!!", "level": "error" }'  \
```  

DELETE
``` 
curl -u apiusername -v \
--header "Content-Type: application/json" \
--header "On-Behalf-Of: mynetid" \
-XDELETE “https://test.star.doit.wisc.edu/api/v2/messages/1234-abcdefg-hijklmno-pqrstuv”
```  

### Troubleshooting
- You can make sure the the messages are being recieved by the front end by navigating to [my.wisc.edu/star](https://my.wisc.edu/star) (or whichever environment you are testing) and inspecting the network traffic for `messages.json`.
 No newline at end of file