Skip to end of metadata
Go to start of metadata

OUT OF DATE

Introduction

This page describes a set of test REST requests, in a logical flow:

Add user Richard Quin

POST on http://localhost:8082/users/

Header: Yona-Password: R i c h a r d

{
   "firstName":"Richard",
   "lastName":"Quin",
   "nickName":"RQ",
   "mobileNumber":"+12345678",
   "devices":[
      "Nexus 6"
   ],
   "goals":[
      {
         "@class":"budgetGoal",
         "activityCategoryName":"gambling",
         "maxDuration":"0"
      }
   ]
}

Richard confirms his mobile number

POSt on http://localhost:8082/users/d82b78d5-670b-4592-bbd2-8925b68f6721/confirmMobileNumber

{
   "code": "48006"
}

Richard requests Bob to become his buddy

POST on http://localhost:8082/users/d82b78d5-670b-4592-bbd2-8925b68f6721/buddies/

Header: Yona-Password: R i c h a r d

{
  "_embedded":{
    "user":{
      "firstName":"Bob",
      "lastName":"Dunn",
      "emailAddress":"bob@dunn.net",
      "mobileNumber":"+13456789"
    }
  },
  "message":"Would you like to be my buddy?",
  "sendingStatus":"REQUESTED",
  "receivingStatus":"REQUESTED"
}

Bob receives an e-mail message with the invitation URL

Yona buddy invitation from Richard Quin
1 message

 


 

Richard Quin <dev@yona.nu>Sat, Nov 28, 2015 at 12:29 PM
To: Bob Dunn <bert@famroos.nu>
Hi Bob Dunn, become my buddy for Yona!

Install the app! Open this URL with the app! http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205?tempPassword=pNHcNUQX0i5UrW9yRqShdQ46lZV%2BT9QX

Best regards,
Richard Quin

Bob fetches the data provided by Richard

GET on http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205?tempPassword=pNHcNUQX0i5UrW9yRqShdQ46lZV%2BT9QX

Header: no special headers required (anonymous access)

The body shows the following:

 {
    "firstName":"Bob",
    "lastName":"Dunn",
    "emailAddress":null,
    "mobileNumber":"+13456789",
    "confirmed":false,
    "_links":{
        "self":{
            "href":"http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205",
            "templated":false
        }
    },
    "_embedded":{
    }
}

Bob saves the data back, with his own device password

PUT on http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205?tempPassword=e82a2ZlFMNDYO7qJdXd8LEA9CT%2Bauq81

Header: Yona-Password: B o b

 {
    "firstName":"Bob",
    "lastName":"Dunn",
    "emailAddress":null,
    "mobileNumber":"+13456789",
    "_links":{
        "self":{
            "href":"http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205",
            "templated":false
        }
    }
}

Bob confirms his mobile number

POSt on http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205/confirmMobileNumber

{
   "code": "86727"
}

Bob checks his direct messages

GET on http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205/messages/direct/

Header: Yona-Password: B o b

The body shows the following:

{
    "_links":{
        "self":{
            "href":"http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205/messages/direct/",
            "templated":false
        }
    },
    "_embedded":{
        "buddyConnectRequestMessages":[
            {
                "user":{
                    "firstName":"Richard",
                    "lastName":"Quin",
                    "emailAddress":null,
                    "mobileNumber":"+31618190609",
                    "confirmed":true
                },
                "nickname":"RQ",
                "message":"Would you like to be my buddy?",
                "accepted":false,
                "rejected":false,
                "_links":{
                    "self":{
                        "href":"http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205/messages/direct/9506939f-84c9-4e83-9858-c7be663e9c5f",
                        "templated":false
                    },
                    "reject":{
                        "href":"http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205/messages/direct/9506939f-84c9-4e83-9858-c7be663e9c5f/reject",
                        "templated":false
                    },
                    "accept":{
                        "href":"http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205/messages/direct/9506939f-84c9-4e83-9858-c7be663e9c5f/accept",
                        "templated":false
                    }
                }
            }
        ]
    }
}

There is a buddy connect request message, which can be accepted or rejected (see lines 27-34)

Bob accepts Richard's buddy request

POST on http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205/messages/direct/9506939f-84c9-4e83-9858-c7be663e9c5f/accept

Header: Yona-Password: B o b

{
  "properties":{
    "message":"Yes, great idea!"
  }
}

Richard checks his anonymous messages

GET on http://localhost:8082/users/34d19fe1-6559-4e6d-be28-3032bbcccdf2/messages/anonymous/

Header: Yona-Password: R i c h a r d

The body shows the following:

{
    "_links":{
        "self":{
            "href":"http://localhost:8082/users/d82b78d5-670b-4592-bbd2-8925b68f6721/messages/anonymous/",
            "templated":false
        }
    },
    "_embedded":{
        "buddyConnectResponseMessages":[
            {
                "user":{
                    "firstName":"Bob",
                    "lastName":"Dunn",
                    "emailAddress":null,
                    "mobileNumber":"+31627132434",
                    "confirmed":false
                },
                "nickname":null,
                "message":"Yes, great idea!",
                "processed":false,
                "_links":{
                    "self":{
                        "href":"http://localhost:8082/users/d82b78d5-670b-4592-bbd2-8925b68f6721/messages/anonymous/9a176bcd-3af1-43fa-a10b-67850dd20e2b",
                        "templated":false
                    },
                    "process":{
                        "href":"http://localhost:8082/users/d82b78d5-670b-4592-bbd2-8925b68f6721/messages/anonymous/9a176bcd-3af1-43fa-a10b-67850dd20e2b/process",
                        "templated":false
                    }
                }
            }
        ]
    }
}

There is a buddy connect response message, which can be processed (see lines 26 - 29)

Richard processes Bob's buddy acceptance

POST on http://localhost:8082/users/d82b78d5-670b-4592-bbd2-8925b68f6721/messages/anonymous/9a176bcd-3af1-43fa-a10b-67850dd20e2b/process

Header: Yona-Password: R i c h a r d

{
   "properties":{
   }
}

Bob checks his direct messages

GET on http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205/messages/direct/

Header: Yona-Password: B o b

The body shows the following:

{
    "_links":{
        "self":{
            "href":"http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205/messages/direct/",
            "templated":false
        }
    },
    "_embedded":{
        "buddyConnectRequestMessages":[
            {
                "user":{
                    "firstName":"Richard",
                    "lastName":"Quin",
                    "emailAddress":null,
                    "mobileNumber":"+31618190609",
                    "confirmed":true
                },
                "nickname":"RQ",
                "message":"Would you like to be my buddy?",
                "accepted":true,
                "rejected":false,
                "_links":{
                    "self":{
                        "href":"http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205/messages/direct/9506939f-84c9-4e83-9858-c7be663e9c5f",
                        "templated":false
                    }
                }
            }
        ]
    }
}

There is a buddy connect request message that has already been accepted

Richard checks his anonymous messages

GET on http://localhost:8080/user/1/message/anonymous/

Header: Yona-Password: R i c h a r d

The body shows the following:

{
    "_links":{
        "self":{
            "href":"http://localhost:8082/users/d82b78d5-670b-4592-bbd2-8925b68f6721/messages/anonymous/",
            "templated":false
        }
    },
    "_embedded":{
        "buddyConnectResponseMessages":[
            {
                "user":{
                    "firstName":"Bob",
                    "lastName":"Dunn",
                    "emailAddress":null,
                    "mobileNumber":"+31627132434",
                    "confirmed":false
                },
                "nickname":null,
                "message":"Yes, great idea!",
                "processed":true,
                "_links":{
                    "self":{
                        "href":"http://localhost:8082/users/d82b78d5-670b-4592-bbd2-8925b68f6721/messages/anonymous/9a176bcd-3af1-43fa-a10b-67850dd20e2b",
                        "templated":false
                    }
                }
            }
        ]
    }
}

There is a buddy connect response message that has already been processed

SmoothWall detects a potential goal conflict

POST on http://localhost:8081/analysisEngine/

Header: no special headers required (anonymous access)

Find the accessor ID in as user ID in the VPN profile of Richard: http://localhost:8082/users/d82b78d5-670b-4592-bbd2-8925b68f6721?includePrivateData=true

{
   "vpnLoginID":"38fc3f71-9f9a-4c8f-b445-aa46a41a46cf",
   "categories":["Gambling"],
   "url":"http://www.poker.com"
}

Richard checks his anonymous messages

GET on http://localhost:8082/users/d82b78d5-670b-4592-bbd2-8925b68f6721/messages/anonymous/

Header: Yona-Password: R i c h a r d

The body shows the following:

{
    "_links":{
        "self":{
            "href":"http://localhost:8082/users/d82b78d5-670b-4592-bbd2-8925b68f6721/messages/anonymous/",
            "templated":false
        }
    },
    "_embedded":{
        "goalConflictMessages":[
            {
                "nickname":"<self>",
                "goalName":"gambling",
                "url":"http://www.poker.com",
                "possibleActions":[
                ],
                "_links":{
                    "self":{
                        "href":"http://localhost:8082/users/d82b78d5-670b-4592-bbd2-8925b68f6721/messages/anonymous/28a29179-2eff-4178-89a9-708a60ab95c0",
                        "templated":false
                    }
                }
            }
        ]
    }
}

Bob checks his anonymous messages

GET on http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205/messages/anonymous/

Header: Yona-Password: B o b

The body shows the following:

{
    "_links":{
        "self":{
            "href":"http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205/messages/anonymous/",
            "templated":false
        }
    },
    "_embedded":{
        "goalConflictMessages":[
            {
                "nickname":"RQ",
                "goalName":"gambling",
                "url":"http://www.poker.com",
                "possibleActions":[
                ],
                "_links":{
                    "self":{
                        "href":"http://localhost:8082/users/81166d8b-8b16-4e64-ba86-730441bbb205/messages/anonymous/3fccb0c4-5290-4785-aa7e-24a1fb2bf574",
                        "templated":false
                    }
                }
            }
        ]
    }
}
  • No labels