...
Read the page on User Defined Modules
Read the page on User-Defined Actions
Read the page on the built-in HTTP library
Completed the Pico State Lesson
Be comfortable testing with the testing tab, postman, or an alternative
...
Our rule, which selects on the movie:new_rating
event, expects a non-empty attribute named movieID
and a numeric attribute named rating
. These are checked for in lines 10 and 11, respectively, and bound to internal (to the rule) names which happen to match the attribute names in line 12. We convert one of the attributes from the passed-in String
to a Number
in line 14, using the universal as
operator. We check that the rating is in the expected range in line 15. If the rating is value valid (line 17) then we take the HTTP POST action in line 17, also capturing the HTTP response, which we then save in the pico in line 19 (along with a timestamp in line 20).
...