Let op! binnenkort wordt de huidige api door onze nieuwsfeed.
There are three different types of newsfeed we support:
- Normal newsfeed that shows the posts created in the platform
- Event List and Event Calendar
- The Picture Gallery
The baseURL for the platform is: https://api.socialschools.eu
Notes: All responses are in JSON and are paginated. The pagination can be
adjusted using the query param `number_of_items`
1. NewsFeed
For newsfeed there are three different combinations you can use:
- For community only
- For community and descendant
- For descendants only
let baseURL = `https://api.socialschools.eu`;
// communityID is the community you want to target
// numberofItems is the number of data in the list
// &no_events=true is required, if you do not want any event posts in the API
${baseURL}/apiv1/public/${communityId}/post/?number_of_items=${numberOfItems}&no_events=true
2. Event List and Calendar
For EventList: The API endpoint has the following format
// The explanation of the variables are the same as the above newsfeed API
// ?upcoming=true means we only show future events from the current date
let finalURL = ${baseURL}/apiv1/public/${communityID}/event/?upcoming=true&number_of_items=${numberOfItems};
Now, for Calendar:
// Same explanation for the variables as the EventList API, one thing to note is that
// there is no numberofItems parameter here, so you will get all the events which makes
// sense because you need more events to populate a calendar and make it useful
let finalURL = ${baseURL}/apiv1/public/${communityID}/event/?upcoming=true;
2.1 Datetime-formatting in the API
The server is independent of the time zone of the client, therefore all times are exchanged as UTC time in the format like this: 2018-11-07T09:00:31Z. It is up to the client to convert to and from local time, most languages will correctly interpret the string. In JS, you can use moment(date).utc().format() to create the string.
Event times are given by the start and end times as strings, and an allDay boolean. For an allDay event, you specify the beginning of the first day and the end of the last day, so a one day event would look like this:
{
start: "2018-11-05T00:00:00Z",
end: "2018-11-06T00:00:00Z",
allDay: true
}
Conversion of event times to days for allDay events can be tricky. There are two pitfalls:
- converting to local time and subsequently taking the date: if you are in a later time zone, this will give the previous day
- taking the day of the end time as end date: the end date is the day before the end time
The correct way to process the times for an allDay event is to take this date part of the string (first 10 character, up to but excluding the T), then subtract one day for the end time.
3. PhotoGallery
API endpoint for photogallery is:
// the number_of_items can be adjusted as per the need of the frontend. This API
// gives all public photos of the community and this API can be used to build a carousel,
// slider or any other kind of image gallery
let finalURL = ${baseURL}/apiv1/public/${communityId}/photo?number_of_items=12;
Opmerkingen
0 opmerkingen
U moet u aanmelden om een opmerking te plaatsen.