Skip to content

Commit 9713aa4

Browse files
committed
added API section to readme.
1 parent a428fbd commit 9713aa4

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,65 @@ The short code has the following configuration options.
3434

3535
`[wplibcalhours location="Parnassus Library" num_weeks=1]` - Prints the opening hours for the "Parnassus Library" for the next week (starting today).
3636

37+
## API
38+
39+
This plugin also exposes opening hours via a read-only, public API endpoint.
40+
41+
Requesting the path `/wp-admin/admin-ajax.php?action=wplibcalhours` on your site will yield
42+
a JSON-formatted payload comprised of dates and opening hours, keyed by their location names.
43+
44+
These lists are sorted in chronological order and contain day-of-the-week, date and the day's opening hours information.
45+
46+
Each list starts with the current date.
47+
48+
#### Example payload
49+
50+
Three locations, the current date is January 3rd.
51+
52+
```json
53+
{
54+
"Parnassus Library": [
55+
{
56+
"day": "Wed",
57+
"date": "Jan 3",
58+
"text": "7:45am - 10pm"
59+
},
60+
{
61+
"day": "Thu",
62+
"date": "Jan 4",
63+
"text": "7:45am - 10pm"
64+
}
65+
//...
66+
],
67+
"Mission Bay Library": [
68+
{
69+
"day": "Wed",
70+
"date": "Jan 3",
71+
"text": "9am - 6pm"
72+
},
73+
{
74+
"day": "Thu",
75+
"date": "Jan 4",
76+
"text": "9am - 6pm"
77+
}
78+
// ...
79+
],
80+
"Mission Bay Hub": [
81+
{
82+
"day": "Wed",
83+
"date": "Jan 3",
84+
"text": "24 hours"
85+
},
86+
{
87+
"day": "Thu",
88+
"date": "Jan 4",
89+
"text": "24 hours"
90+
}
91+
// ...
92+
]
93+
}
94+
```
95+
3796
## Styling
3897

3998
Please see this [Wiki page](https://github.com/ucsf-ckm/wplibcalhours/wiki/Styling-The-Output) for ideas on how to customize the styles of this plugin's generated markup.

0 commit comments

Comments
 (0)