Example: Adding an App

This example walks you through adding an app to the Akana API Platform by using the API rather than the user interface. One use of this sequence is to build code that will load multiple apps via the platform. This could be useful if you are just getting started on the platform and have many apps.

This exercise assumes that you already have a valid login for the Akana API Platform. You can't add an app unless you're an authorized user. Before running the procedures below, go into the user interface to create your user account.

Essentially, you'll need to complete these two activities, in sequence:

  1. Log in using your authorized user profile you've already set up. Operation: POST /api/login.
  2. Create an app. This also adds the first app version. Operation: POST /api/apps.

Once you've completed the above steps, the AppID is returned in the response and the app is ready for use.

Follow the detailed instructions below.

To add an app in the Akana API Platform using the API

  1. Log in via the API, POST /api/login operation, using your own email and password in the body of the operation instead of the placeholder values given below.
    • HTTP method: POST
    • URL: https://{hostname}/api/login
    • Accept header: application/json
    • Content-Type header: application/json
    • Request Body:
      {
        "email":"MyEmailAddress",
        "password":"MyPassword"
      }

    The platform API returns the login cookie, which you'll need to send with the request headers for any operation that requires login, and the CSRF cookie, which you'll need to use to put together the CSRF header if required by platform settings (not covered in this exercise: see Example: Using the CSRF header).

  2. Add the app, using the POST /api/apps operation. In your API call, use the values below, modifying the URL path as needed, and filling your own values for all fields in the Request Body (URL encoding not needed). Tags are optional, but all other values are required.
    • HTTP method: POST
    • URL: https://{hostname}/api/apps
    • Accept header: application/vnd.soa.v84+json
    • Content-Type header:application/vnd.soa.v84+json
    • CSRF header: include it if needed. If you are not sure whether it's needed or not, refer to CSRF Prevention on the Platform. If your operation is unsuccessful, with a 401 response, it might be because CSRF is needed.
    • Request Body (this example includes the optional website address, but you can delete that value, keeping the line with an empty value):
      {
        "Name":"MyAppName",
        "Summary":"My app summary",
        "Description":"MyAppDescription",
        "ApplicationVersion":{
          "Name":"1.0",
          "Description":"MyAppVersionDescription",
          "Tag":[
            "puzzle",
            "language",
            "learning",
            "iPhone",
            "Android"
          ],
          "Visibility":"Public",
          "Identity":"",
          "SharedSecret":"",
          "WebsiteAddress":"www.mywebsiteaddress.com"
        },
        "PictureID":""
      }
  3. Take the AppID returned in the response; you will use it later.
  4. Repeat steps 2 and 3 as needed to add subsequent apps.
  5. When done, remember to log out using the GET /api/login/endsession operation. Use the following values:
    • URL: https://{hostname}/api/login/endsession
    • Accept header: application/json