I am doing a project for fun and one of the requirements is to the JSON data from an API of my choice and transform it into an activity stream using angularjs.
I've googled and read what an activity stream is and I believe I have a basic understanding of it. It's essentially transforming an action into a specific JSON format using the keywords "actor", "verb", "object", and "target".
When I look at examples, I understand why that specific JSON string is considered an activity stream.
Example:
{
"published": "2011-02-10T15:04:55Z",
"actor": {
"url": "http://example.org/martin",
"objectType" : "person",
"id": "tag:example.org,2011:martin",
"image": {
"url": "http://example.org/martin/image",
"width": 250,
"height": 250
},
"displayName": "Martin Smith"
},
"verb": "post",
"object" : {
"url": "http://example.org/blog/2011/02/entry",
"id": "tag:example.org,2011:abc123/xyz"
},
"target" : {
"url": "http://example.org/blog/",
"objectType": "blog",
"id": "tag:example.org,2011:abc123",
"displayName": "Martin's Blog"
}
}
But I'm confused in terms of how to transform my JSON Data into an activity stream.
My JSON doesn't have an "actor", nor does it have a "verb". If anyone can please explain or provide a solution that would be greatly appreciated. Thank you!
Weather API
{
"coord": {
"lon": -0.13,
"lat": 51.51
},
"weather": [
{
"id": 300,
"main": "Drizzle",
"description": "light intensity drizzle",
"icon": "09d"
}
],
"base": "stations",
"main": {
"temp": 280.32,
"pressure": 1012,
"humidity": 81,
"temp_min": 279.15,
"temp_max": 281.15
},
"visibility": 10000,
"wind": {
"speed": 4.1,
"deg": 80
},
"clouds": {
"all": 90
},
"dt": 1485789600,
"sys": {
"type": 1,
"id": 5091,
"message": 0.0103,
"country": "GB",
"sunrise": 1485762037,
"sunset": 1485794875
},
"id": 2643743,
"name": "London",
"cod": 200
}
ActivityStream is just a specification for activities. Weather is just a model. A model can either be a subject/actor or an object that an actor acts upon to. In this case, weather can only be an object.
An example of activity that deals with weather is:
The corresponding activity JSON is:
Note that this is only an example. You may have different activities, depending on how you want to use the weather data.