Skip to end of metadata
Go to start of metadata

Introduction

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

Add user Richard Quin

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

Headers:

  • Content-Type: application/json
  • Accept-Language: en-US
{
  "firstName": "Richard",
  "lastName": "Quin",
  "mobileNumber": "+31612345678",
  "nickname": "RQ"
}

Richard confirms his mobile number

POST on http://localhost:8082/users/3fdd5f28-23bd-4255-ae1b-c1e0383efd77/resendMobileNumberConfirmationCode

Headers:

  • Yona-Password: AES:128:uMCQNKhNqcGgC2q6fbTF4Q==
  • Content-Type: application/json
  • Accept-Language: en-US
{
   "code": "1234"
}

Add user Bob Dunn

(warning) From here onward, the requests are slightly out of date.

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

Headers:

  • Yona-Password: B o b
  • Content-Type: application/json
  • Accept-Language: en-US
{
  "firstName":"Bob",
  "lastName":"Dunn",
  "nickname":"BD",
  "mobileNumber":"+13456789"
}

Bob confirms his mobile number

POST on http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/confirmMobileNumber

Headers:

  • Yona-Password: B o b
  • Content-Type: application/json
  • Accept-Language: en-US
{
   "code": "1234"
}

Richard requests Bob to become his buddy

POST on http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b/buddies/

Headers:

  • Yona-Password: R i c h a r d
  • Content-Type: application/json
  • Accept-Language: en-US
{
  "_embedded":{
    "yona:user":{
      "firstName":"Bob",
      "lastName":"Dunn",
      "emailAddress":"bob@dunn.net",
      "mobileNumber":"+13456789"
    }
  },
  "message":"Would you like to be my buddy?",
  "sendingStatus":"REQUESTED",
  "receivingStatus":"REQUESTED"
}

Bob checks his messages

GET on http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/messages/

Headers:

  • Yona-Password: B o b
  • Accept-Language: en-US

The body shows the following:

{
  "_embedded": {
    "yona:messages": [
      {
        "creationTime": "2016-04-26T17:31:51.241+0000",
        "nickname": "RQ",
        "message": "Hi there, would you want to become my buddy?",
        "status": "REQUESTED",
        "_links": {
          "self": {
            "href": "http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/messages/0f76530d-c956-4d1b-b2f1-9e30b4bf6871"
          },
          "yona:reject": {
            "href": "http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/messages/0f76530d-c956-4d1b-b2f1-9e30b4bf6871/reject"
          },
          "yona:accept": {
            "href": "http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/messages/0f76530d-c956-4d1b-b2f1-9e30b4bf6871/accept"
          }
        },
        "_embedded": {
          "yona:user": {
            "firstName": "Richard",
            "lastName": "Quin",
            "mobileNumber": "+31612345678",
            "_links": {
              "self": {
                "href": "http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b"
              }
            }
          }
        },
        "@type": "BuddyConnectRequestMessage"
      }
    ]
  },
  "_links": {
    "self": {
      "href": "http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/messages/?size=10&page=0"
    },
    "curies": [
      {
        "href": "http://dev.yona.nu/rels/{rel}",
        "name": "yona",
        "templated": true
      }
    ]
  },
  "page": {
    "size": 20,
    "totalElements": 1,
    "totalPages": 1,
    "number": 0
  }
}

There is a buddy connect request message, which can be accepted (see line 17)

Bob accepts Richard's buddy request

POST on http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/messages/0f76530d-c956-4d1b-b2f1-9e30b4bf6871/accept

Headers:

  • Yona-Password: B o b
  • Content-Type: application/json
  • Accept-Language: en-US
{
  "properties":{
    "message":"Yes, great idea!"
  }
}

Richard checks his messages

GET on http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b/messages/

Headers:

  • Yona-Password: R i c h a r d
  • Accept-Language: en-US

The body shows the following:

{
  "_embedded": {
    "yona:messages": [
      {
        "creationTime": "2016-04-26T17:36:24.176+0000",
        "nickname": "BD",
        "message": "Yes, great idea!",
        "status": "ACCEPTED",
        "_links": {
          "self": {
            "href": "http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b/messages/221f6b1b-e77c-4ab2-ba95-864e32c9dab5"
          },
          "yona:process": {
            "href": "http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b/messages/221f6b1b-e77c-4ab2-ba95-864e32c9dab5/process"
          },
          "yona:user": {
            "href": "http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88"
          }
        },
        "@type": "BuddyConnectResponseMessage"
      }
    ]
  },
  "_links": {
    "self": {
      "href": "http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b/messages/"
    },
    "curies": [
      {
        "href": "http://dev.yona.nu/rels/{rel}",
        "name": "yona",
        "templated": true
      }
    ]
  },
  "page": {
    "size": 20,
    "totalElements": 1,
    "totalPages": 1,
    "number": 0
  }
}

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

Richard processes Bob's buddy acceptance

POST on http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b/messages/221f6b1b-e77c-4ab2-ba95-864e32c9dab5/process

Headers:

  • Yona-Password: R i c h a r d
  • Content-Type: application/json
  • Accept-Language: en-US
{
   "properties":{
   }
}

Bob checks his messages

GET on http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/messages/

Headers:

  • Yona-Password: B o b
  • Accept-Language: en-US

The body shows the following:

{
  "_embedded": {
    "yona:messages": [
      {
        "creationTime": "2016-04-26T17:31:51.241+0000",
        "nickname": "RQ",
        "message": "Hi there, would you want to become my buddy?",
        "status": "ACCEPTED",
        "_links": {
          "self": {
            "href": "http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/messages/0f76530d-c956-4d1b-b2f1-9e30b4bf6871"
          },
          "edit": {
            "href": "http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/messages/0f76530d-c956-4d1b-b2f1-9e30b4bf6871"
          }
        },
        "_embedded": {
          "yona:user": {
            "firstName": "Richard",
            "lastName": "Quin",
            "mobileNumber": "+31612345678",
            "_links": {
              "self": {
                "href": "http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b"
              }
            }
          }
        },
        "@type": "BuddyConnectRequestMessage"
      }
    ]
  },
  "_links": {
    "self": {
      "href": "http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/messages/"
    },
    "curies": [
      {
        "href": "http://dev.yona.nu/rels/{rel}",
        "name": "yona",
        "templated": true
      }
    ]
  },
  "page": {
    "size": 20,
    "totalElements": 1,
    "totalPages": 1,
    "number": 0
  }
}

There is a buddy connect request message that has already been accepted (no accept or reject link anymore, but an edit link that allows deleting the message).

Richard checks his messages

GET on http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b/messages/

Headers:

  • Yona-Password: R i c h a r d
  • Accept-Language: en-US

The body shows the following:

{
  "_embedded": {
    "yona:messages": [
      {
        "creationTime": "2016-04-26T17:36:24.176+0000",
        "nickname": "BD",
        "message": "Yes, great idea!",
        "status": "ACCEPTED",
        "_links": {
          "self": {
            "href": "http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b/messages/221f6b1b-e77c-4ab2-ba95-864e32c9dab5"
          },
          "edit": {
            "href": "http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b/messages/221f6b1b-e77c-4ab2-ba95-864e32c9dab5"
          },
          "yona:user": {
            "href": "http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88"
          }
        },
        "@type": "BuddyConnectResponseMessage"
      }
    ]
  },
  "_links": {
    "self": {
      "href": "http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b/messages/"
    },
    "curies": [
      {
        "href": "http://dev.yona.nu/rels/{rel}",
        "name": "yona",
        "templated": true
      }
    ]
  },
  "page": {
    "size": 20,
    "totalElements": 1,
    "totalPages": 1,
    "number": 0
  }
}

There is a buddy connect response message that has already been processed (no accept or reject link but an edit link through which the message can be deleted).

Smoothwall detects a potential goal conflict

Each HTTP request is logged by Smoothwall. Our Perl script analyzes this log and checks whether the Smoothwall category occurs in the list of relevant Smoothwall categories (http://localhost:8081/analysisEngine/relevantSmoothwallCategories/). If it is, it it POSTs a message as described below to the analysis engine of Yona server.

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

Headers:

  • Content-Type: application/json
  • Accept-Language: en-US

Find the VPN login ID in as user ID in the VPN profile of Richard: http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b?includePrivateData=true

 

{
   "vpnLoginID":"4ef09af0-522e-4cdd-adf2-ae3509397558",
   "categories":["Gambling"],
   "url":"http://www.poker.com"
}

Richard checks his messages

GET on http://localhost:8082/users/0407f766-5ddd-4fa3-913f-6e7ca8cd7c6c/messages/

Headers:

  • Yona-Password: R i c h a r d
  • Accept-Language: en-US

The body shows the following:

{
  "_embedded": {
    "yona:messages": [
      {
        "creationTime": "2016-04-26T17:50:59.755+0000",
        "nickname": "<self>",
        "url": "http://www.poker.com",
        "status": "ANNOUNCED",
        "activityStartTime": "2016-04-26T17:50:59.566+0000",
        "activityEndTime": "2016-04-26T17:50:59.566+0000",
        "_links": {
          "self": {
            "href": "http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b/messages/d1b1c244-319b-4b0e-9a59-790451878f54"
          },
          "edit": {
            "href": "http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b/messages/d1b1c244-319b-4b0e-9a59-790451878f54"
          },
          "yona:activityCategory": {
            "href": "http://localhost:8082/activityCategories/192d69f4-8d3e-499b-983c-36ca97340ba9"
          }
        },
        "@type": "GoalConflictMessage"
      },
      {
        "creationTime": "2016-04-26T17:36:24.176+0000",
        "nickname": "BD",
        "message": "Yes, great idea!",
        "status": "ACCEPTED",
        "_links": {
          "self": {
            "href": "http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b/messages/221f6b1b-e77c-4ab2-ba95-864e32c9dab5"
          },
          "edit": {
            "href": "http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b/messages/221f6b1b-e77c-4ab2-ba95-864e32c9dab5"
          },
          "yona:user": {
            "href": "http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88"
          }
        },
        "@type": "BuddyConnectResponseMessage"
      }
    ]
  },
  "_links": {
    "self": {
      "href": "http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b/messages/"
    },
    "curies": [
      {
        "href": "http://dev.yona.nu/rels/{rel}",
        "name": "yona",
        "templated": true
      }
    ]
  },
  "page": {
    "size": 20,
    "totalElements": 2,
    "totalPages": 1,
    "number": 0
  }
}

Bob checks his messages

GET on http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/messages/

Headers:

  • Yona-Password: B o b
  • Accept-Language: en-US

The body shows the following:

{
  "_embedded": {
    "yona:messages": [
      {
        "creationTime": "2016-04-26T17:51:00.432+0000",
        "nickname": "RQ",
        "url": null,
        "status": "ANNOUNCED",
        "activityStartTime": "2016-04-26T17:50:59.566+0000",
        "activityEndTime": "2016-04-26T17:50:59.566+0000",
        "_links": {
          "self": {
            "href": "http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/messages/c28d6b73-d58a-442c-a1bb-16c1edc3cf91"
          },
          "yona:requestDisclosure": {
            "href": "http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/messages/c28d6b73-d58a-442c-a1bb-16c1edc3cf91/requestDisclosure"
          },
          "edit": {
            "href": "http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/messages/c28d6b73-d58a-442c-a1bb-16c1edc3cf91"
          },
          "yona:activityCategory": {
            "href": "http://localhost:8082/activityCategories/192d69f4-8d3e-499b-983c-36ca97340ba9"
          }
        },
        "@type": "GoalConflictMessage"
      },
      {
        "creationTime": "2016-04-26T17:31:51.241+0000",
        "nickname": "RQ",
        "message": "Hi there, would you want to become my buddy?",
        "status": "ACCEPTED",
        "_links": {
          "self": {
            "href": "http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/messages/0f76530d-c956-4d1b-b2f1-9e30b4bf6871"
          },
          "edit": {
            "href": "http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/messages/0f76530d-c956-4d1b-b2f1-9e30b4bf6871"
          }
        },
        "_embedded": {
          "yona:user": {
            "firstName": "Richard",
            "lastName": "Quin",
            "mobileNumber": "+31612345678",
            "_links": {
              "self": {
                "href": "http://localhost:8082/users/9288a7d2-127d-4312-8890-0e29ddc7d93b"
              }
            }
          }
        },
        "@type": "BuddyConnectRequestMessage"
      }
    ]
  },
  "_links": {
    "self": {
      "href": "http://localhost:8082/users/2cce3d82-4a25-434b-be8b-5eec53e6fc88/messages/"
    },
    "curies": [
      {
        "href": "http://dev.yona.nu/rels/{rel}",
        "name": "yona",
        "templated": true
      }
    ]
  },
  "page": {
    "size": 20,
    "totalElements": 2,
    "totalPages": 1,
    "number": 0
  }
}
  • No labels