Commit 6847eaa0 authored by Chelsea Gille's avatar Chelsea Gille
Browse files

Migrated to...

Migrated to https://git.doit.wisc.edu/finance/documentation/-/blob/master/star/Support.md because it is not meant to be a public facing service doc
parent fbd14505
Loading
Loading
Loading
Loading

star/Support.md

deleted100644 → 0
+0 −58
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 (`-u apiusername` will prompt you for a password. LastPass will have the user/pass) 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 receivdfed 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