_ _ _ _ _ _ _ _ _ ___ _ _ ___ _ _ ___ |_ |_| | | \ |_| \ / | | |_ |_ |/ |_ |\ | | \ |_ |\ | | |_ |_| | |_| | |\ | |\/| |_ |\ | | | |\ | |_/ | | | |/\| |_ |_ |\ |_ | \| |_/ |_ | \| | |_ |\ | | | | | \| | | |_ | \| | For Developers API Reference version 6.0.5 ----------------- Chapter one: JSON ----------------- Please note that we do not offer JSONP anymore. It is connected with the latest springsecurity 5.1 update. In order of using our JSON services from third party domains please contact us in order to add your domain name to our @CrossOrigin policy. In order to obtain CSRF token please use: https://www.fridayweekend.com/rest/csrf Lets assume that we have Friday Weekend Lottery created with code "492-790". Then we can get following JSON data: https://www.fridayweekend.com/rest/getLottery/492/790 https://www.fridayweekend.com/rest/getLotteryResults/492/790 To get JSON data with 3 newest lotteries (optional per issuer and/or near to given location lat, lon): https://www.fridayweekend.com/rest/getNewLotteries/3?host=https://www.example.com https://www.fridayweekend.com/rest/getNewLotteries/3/{lat}/{lon}?host=https://www.example.com To check details of user that is logged in the same session as your request please use: https://www.fridayweekend.com/rest/getLoggedUser?host=https://www.example.com To check user login for email and token use this service: https://www.fridayweekend.com/rest/getLogin/{token}?email={email} ----------------------------- Chapter two: SOAP Web Service ----------------------------- To add predefined entertainment suggestions for user to show it in autocomplete box we can use: https://www.fridayweekend.com/ws/addEntertainment?wsdl Tags should be CSV formated and this values will be used to match entertainment to user input data. After approval, confirmation email will be sent to given email address. Available languages (ISO-639-1): en, de, es, fr, it, pl, pt, ru, zh. Available icons: /resources/icons/beach.png /resources/icons/bridge.png /resources/icons/camp.png /resources/icons/camper.png /resources/icons/canu.png /resources/icons/car.png /resources/icons/drink.png /resources/icons/duck.png /resources/icons/fire.png /resources/icons/fishing.png /resources/icons/flowers.png /resources/icons/forest.png /resources/icons/glasses.png /resources/icons/marine.png /resources/icons/rain.png /resources/icons/rest.png /resources/icons/ski.png /resources/icons/snorking.png /resources/icons/sunumbrella.png /resources/icons/sunset.png /resources/icons/swimming.png /resources/icons/tundra.png /resources/icons/umbrella.png /resources/icons/ball.png /resources/icons/castle.png /resources/icons/crab.png /resources/icons/duckwheel.png /resources/icons/fish.png /resources/icons/hat.png /resources/icons/hawaii.png /resources/icons/ice.png /resources/icons/icefun.png /resources/icons/palm.png /resources/icons/redumbrella.png /resources/icons/sandbox.png /resources/icons/shell.png /resources/icons/shoes.png /resources/icons/snork.png /resources/icons/starfish.png /resources/icons/sun.png /resources/icons/sunfun.png /resources/icons/sunglasses.png /resources/icons/wave.png /resources/icons/balloon.png /resources/icons/heli.png /resources/icons/humvee.png /resources/icons/moto.png /resources/icons/motored.png /resources/icons/motoyellow.png /resources/icons/plane.png /resources/icons/ship.png /resources/icons/submarine.png /resources/icons/taxi.png /resources/icons/train.png /resources/icons/truck.png /resources/icons/bitcoin.png /resources/icons/game.png /resources/icons/bike.png /resources/icons/slot.png /resources/icons/book.png /resources/icons/tools.png /resources/icons/gym.png /resources/icons/painting.png /resources/icons/guitar.png /resources/icons/patrick.png /resources/icons/cooking.png To add issuer mapping, in order to use its code instead of URL address one can use: https://www.fridayweekend.com/ws/addIssuer?wsdl Note that the email field should contain registered users csv emails addresses list to whom special moderator rights will be granted. Username and password fields should contain credentials to basic authentication required to access CardService and LicenseService data and to remote call issuers' authentication-requiring backoffice services. -------------------------------------------------- Chapter three: Frontend integration with your site -------------------------------------------------- Assume you have a site www.example.com that is registered as a microcurrency issuer. # A Create a link: https://www.fridayweekend.com/create?after=https://www.example.com/your/path/ Then your user can create a lottery and after that he will be navigated back to: https://www.example.com/your/path/?code=49&key=7901 (Assuming, that he has created a lottery with code 49 and key 7901.) # B You can display to your user following form to establish a session on www.fridayweekend.com:
Login with facebook Login with google After a successful login he will be redirected back to https://www.example.com/path/?go. In case of login error he will be redirected to https://www.example.com/path?login=failed. Note: Login topics & bodies will be processed only when they are connected with a new Issuer where given user does not have any point yet. # C To create account let your user submit this form:
After a successful registration he will be logged in and redirected back to https://www.example.com/path/?go. In case of login error he will be redirected to https://www.example.com/path?register=failed. Two last parameters: csvRegistrationTopics and csvRegistrationBodies are optional. Use it to boost new user account right after registration action. # D To send an SMS let your user (when logged in) submit this form:
After the SMS sending action he will be navigated to success or failure URL respectively. Note that amount attribute makes sense only when playing lotteries or confirming a bet. # E To change user password let your user (when logged in) submit this form:
After the password change action he will be navigated to success or failure URL respectively. # F To edit profile let your user (when logged in) submit this form:
After the profile update action he will be navigated to success or failure URL respectively. # G To log out a user let him submit a form:
After a logout action he will be navigated to https://www.example.com/success/path URL. Just make sure, that he is logged-in before doing this! # H To send to user reset-password link with your domain, let him submit a form:
After the notification action he will be navigated to success or failure URL respectively. He will receive an email with link like this: https://www.example.com/reset/{token}. To reset his password, let him submit a form:
After the reset password action he will be logged in automatically and navigated to success or failure URL respectively. # I When logged in as a moderator (an user with email address that has been given during issuer registration procedure - see chapter two: issuer service) submit a form:
to send a special SMS which was already assigned by issuer to a particular user. This sms will be send on behalf of user which is assigned to this SMS. For this SMS, the issuer's CardService should return a JSON answer with "username" field set to the login of the user that it is assigned to. # J When logged in call this JSON service: https://www.fridayweekend.com/user/remote?code=XXXX&backoffice=https://www.example.com/remote/action/path It will do async HTTP GET the url you pointed in backoffice param: https://www.example.com/remote/action/path?username=login using related issuer credentials for basic authentication (see chapter two: issuer service) and adding GET parameter 'username' with the value of current user login. The issuer url for issuer code need to be the exactly the same as the beginning of the backoffice param passed here. # K When logged in as a moderator (an user with email address that has been given during issuer registration procedure - see chapter two: issuer service) call a JSON(P) service: https://www.fridayweekend.com/moderator/history/{code}/{series} to obtain a chronological list of cards (from given series) issued by issuer with given code and already used by some player. Series is the ending of the token (see chapter seven: microcurrency issuer - card service) --------------------------- Chapter four: Add a lottery --------------------------- You can programatically add a lottery which consits of already existing entertainments. Call https: Request URL: https://www.fridayweekend.com/rest/addLottery Request Method: POST Query String Parameters: -existingEntertainmentIdsList -lotteryDateTime -lotteryTimezoneOffset -instructions -random -highlighted -required -colors -points -seconds -topic -issuer -lon -lat PHP example: token; $points = '9'; $seconds = '0'; $random = '0'; $highlighted = '2'; $required = '3'; $colors = '7'; $timezone = '-120'; $date = '2015-07-28 18:30'; $csv = '491,492,49,78,80,157,457'; $topic = ''; $instructions = 'Dear player this are instructions for you'; $issuerCode = ''; $lon = '-17.1254146'; $lat = '33.328373'; // script: $url = 'https://www.fridayweekend.com/rest/addLottery'; $myvars = "existingEntertainmentIdsList=$csv&lotteryDateTime=$date&lotteryTimezoneOffset=$timezone&instructions=$instructions"; $myvars .= "&points=$points&colors=$colors&seconds=$seconds&topic=$topic&issuerCode=$issuerCode&lon=$lon&lat=$lat"; $myvars .= "&random=$random&highlighted=$highlighted&required=$required&_csrf=$csrf"; curl_setopt( $ch, CURLOPT_URL, $url ); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt( $ch, CURLOPT_POST, 1); curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt( $ch, CURLOPT_HEADER, 0); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec( $ch ); echo $response; ?> This will return lottery JSON data with lottery code and key. Use them to display lottery. ------------------------------------------- Chapter five: JSON(P) Short Message Service ------------------------------------------- When logged in add SMS with YOUR_TOPIC and YOUR_CONTENT as described in Chapter three # D. Then your JSON data will be accessible via url: https://www.fridayweekend.com/rest/sms/topic/YOUR_TOPIC When topic already created - only the creator can update its content. But everyone else (except the creator) can add song to its jukebox by sending SMS with YOUR_TOPIC as described in Chapter three #D. Then to retreive last N messages from jukebox YOUR_TOPIC call: https://www.fridayweekend.com/rest/sms/jukebox/N/YOUR_TOPIC Use special topic regex pattern (jukebox described above is not supported then): ([a-zA-Z0-9]+)-([a-zA-Z0-9]+)-([a-z0-9]+) to play lottery with code-key: $1-$2 as a color: $3. Your message content will be published on the corresponding lottery page then. You will be notified via email when the lottery results will be available. Call url: https://www.fridayweekend.com/rest/sms/story/YOUR_TOPIC to retreive whole story for user who added topic YOUR_TOPIC. Call url: https://www.fridayweekend.com/rest/sms/credit/YOUR_TOPIC to get player credit (for player who is owner of YOUR_TOPIC). ----------------- Chapter six: Bets ----------------- To create a bet one need to make a reservation for results. Lets assume that we want to publish our results on URL https://www.fridayweekend.com/rest/sms/topic/EXAMPLE. Then just call sms service from chapter five with topic "EXAMPLE" and not empty content. Now you can create a lottery. Pass "EXAMPLE" value for parameter connected with "Wait for results..." option. When lottery finishes system will be checking URL with results every 5 minutes until it will find JSON results data there. To set the results you need to do next call to our sms service with topic "EXAMPLE" and JSON results data in content. One can use: https://www.fridayweekend.com/rest/getLotteryResults/CODE/KEY as a JSON results data template. Just change the values of flag "highlighted" to true for entertainments that wins. ----------------------------------- Chapter seven: Microcurrency Issuer ----------------------------------- To issue your microcurrency you should create two REST JSON services on your site. Spec: * LicenseService * Use this service to point a lottery that your currency consumer can play. Users without your currency will not be able to play these lotteries. Lets assume that while creating a lottery you passed a results to be syncronized with topic "EXAMPLE" and issuer "$license_service_code" (associated with $http_license_service_address). So your LicenseService should reply 200 OK to HTTP GET: $http_license_service_address/license/EXAMPLE a JSON answer: { "issuer": "$http_license_service_address", "topic": "EXAMPLE", "allowed": true } Users with unsufficient amount of credit in your micro currency will not be allowed to play this game. * CardService * Use this service to generate a currency credit. Print it (e.g. as QR code) and give it to your currency cunsomer. Your currency cunsomer can add points to his micro currency account by calling our sms service. Lets assume that you want to generate a Card with credit "+5 points". Your CardService must reply 200 OK to HTTP GET: $http_license_service_address/card/$your_unique_5_points_hash_token a JSON answer: { "issuer": "$http_license_service_address", "token": "$your_unique_5_points_hash_token", "points": 5, "subject": "Confirmation email subject", "congrats": "Congratulations, you successfully added 5 points to your account!", "username": "" } When user will call our sms service from chapter five: subject: $your_unique_5_points_hash_token message: $license_service_code He will get 5 points in your micro currency added to his account. Note 1: To obtain your $license_service_code please use SOAP web service from Chapter two. Note 2: If you set subject & message as one of csvRegistrationTopics & csvRegistrationBodies (respectively) during uer registration - his account will be boost with given amount of points. If points are equals to 0 - hist account will be boost according to "firstZeroBoost" parameter passed during issuer registartion (see chapter two). ---------------------------- Chapter eight: Players' info ---------------------------- Assume, that someone plays game "123-abc" as a color "red". Use these JSON(P) services to obtain players' info such as all issuers for this player, total market points per issuer and top players per issuer: JSON: https://www.fridayweekend.com/rest/sms/player/issuers/123-abc-red https://www.fridayweekend.com/rest/sms/total/market?host=https://www.example.com https://www.fridayweekend.com/rest/sms/top/players?host=https://www.example.com ------------------------ Chapter nine: Disclaimer ------------------------ If you use our API on your site please add our logo linked to https://www.fridayweekend.com. Thanks! We give you absolutely no warranty about our service. ---------------------- Chapter ten: Support ---------------------- In order of any questions please do not hesitate to contact us via our official facebook fan page: https://www.facebook.com/thefridayweekend Have an awesome weekend! Kind Regards, F R I D A Y W E E K E N D E N T E R T A I N M E N T