Introducing the New iKnode SDK

Have you ever tried to call a Web Service from .Net or Javascript ? It is pretty simple. Right? This is true if you are only doing GET requests without security. Things start to get complicated once your start using security and doing POST requests.

There are frameworks that make it easier, but even after you reduce the complexity by adding a library to handle Web Requests, parsing adds to the problem. Thinking about these two problem we designed an SDK for iKnode Applications that makes it extremely simple to execute from your client.

First, by handling ALL Web Requests without your client having to know about the security or how to do POST requests. Second it parses the results as as native C# classes or Javascript objects.

One very important aspect of the new SDK, is that you learn it once in any language, and you learn it for the rest. Right now we are only supporting C# and Javascript, but the Android and iOS SDKs are on the way and will be handled in the same way, focused completly on consitency.

It’s time to look at some code. Let’s say that we are building a User Service which is used to manage User information in the cloud:

UserService iKnode Application
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
using iKnode.Applications;
using iKnodeSdk.UnitTest.Domain;

namespace iKnodeSdkTest
{
    /// <summary>
    /// Defines the User Service.
    /// </summary>
 [Application]
  public class UserService
  {
        /// <summary>
        /// Gets the User First Name by its identifier.
        /// </summary>
        /// <param name="id">User Identifier.</param>
        /// <returns>User First Name/.</returns>
        public string GetFirstNameById(int id)
        {
            return "Robert";
        }

        /// <summary>
        /// Gets the Most Common User First Name.
        /// </summary>
        /// <returns>Most Common User First Name/.</returns>
        public string GetMostCommonFirstName()
        {
            return "John";
        }

        /// <summary>
        /// Gets the User by its identifier.
        /// </summary>
        /// <param name="id">User Identifier.</param>
        /// <returns>User Information.</returns>
        public User GetById(int id)
        {
            if(id != 1) {
                return null;
            }

            return new User(1, new FullName("John", "Doe"));
        }

        /// <summary>
        /// Saves the User Information.
        /// </summary>
        /// <param name="user">User Information.</param>
        /// <returns>User Identifier.</returns>
        public int Save(User user)
        {
            if(user == null) {
                return -1;
            }

            //TODO: Here your store the User Information.

            return user.Id;
        }

        /// <summary>
        /// Creates a new User with the Default Information.
        /// </summary>
        /// <returns>User Information.</returns>        
        public User CreateDefault()
        {
            return new User(2, new FullName("Jane", "Doe"));
        }

        /// <summary>
        /// Creates a new User.
        /// </summary>
        /// <param name="id">Identifier.</param>
        /// <param name="name">Name.</param>
        /// <returns>User Information.</returns>        
        public User Create(int id, FullName name)
        {
            return new User(id, name);
        }
  }
}

In this case we are going to have the following classes as part of the model to be shared by the service and the C# client. For the Javascript client the model is not required.

Model
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
namespace iKnodeSdkTest
{
    /// <summary>
    /// Defines the Full Name class.
    /// </summary>
    [Serializable]
    public class FullName
    {
        /// <summary>
        /// First Name.
        /// </summary>
        public string FirstName;

        /// <summary>
        /// Last Name.
        /// </summary>
        public string LastName;

        /// <summary>
        /// Initializes a new instance of the <see cref="FullName"/> class.
        /// </summary>
        /// <param name="firstName">First Name/</param>
        /// <param name="lastName">Last Name.</param>
        public FullName(string firstName, string lastName)
        {
            this.FirstName = firstName;
            this.LastName = lastName;
        }
    }

    /// <summary>
    /// Defines the User class.
    /// </summary>
    [Serializable]
    public class User
    {
        /// <summary>
        /// Identifier.
        /// </summary>
        public int Id;

        /// <summary>
        /// Full Name.
        /// </summary>
        public FullName Name;

        /// <summary>
        /// Initializes a new instance of the <see cref="User"/> class.
        /// </summary>
        /// <param name="id">Identifier.</param>
        /// <param name="name">Name.</param>
        public User(int id, FullName name)
        {
            this.Id = id;
            this.Name = name;
        }
    }
}

Now in the C# client side, you would call the UserService in the following way:

C# Client
1
2
3
4
5
6
7
8
9
10
11
// Creating User Id 1 with Name jdoe.
ApplicationClient userSvc = new ApplicationClient(
                        "https://api.iknode.com",
                        UserId,
                        ApiKey,
                        "UserService");

User user = userSvc.Execute<User>(
                      "Create",
                      new MethodParameter("id", 1),
                      new MethodParameter("name", "jdoe"));

Now in Javascript the same call would look like this:

Javascript Client
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
   var userSvc = new iKnodeSdk.ApplicationClient({
      userId: USERID,
      apiKey: APIKEY,
      appName: "UserService"
  });

  var user = userSvc.execute({
      methodName: "Create",
      parameters: [{
              name: "id",
              value: 1
          },{
              name: "name",
              value: "jdoe"
          }
      ]
  });

It is as simple as that. The source code for the SDK can be found here. Each platform SDK has a set of Unit Tests that show how the SDK can be used.

If you have any questions don’t hesitate to ask questions in the forums.

We Are Launching at DEMO 2012

We are launching at DEMO Fall 2012!!! Look for us in the Pavilion in kiosk S12. As part of the launch we have posted the pricing, a new website and a special offer: anybody that registers during the month of October will get November free as well. No credit card is required, so go ahead and just signup if you haven’t already.

We want to thank our Beta users, we really appreciate your feedback. All your data and applications will still be there, and you will get the rest of the year free.

Finally We also want to thank Microsoft for sponsoring us to launch at DEMO. We have been working with Microsoft’s technologies for the past 10 years, and we are proud to be part of the Bizspark program.

And with no further ado, here are some pictures of the event:

Our Badges: DEMO Badges

Beautifully created flyer for DEMO: DEMO Flyer

iKnode Signage: DEMO Signage

iKnode kiosk’s next to Windows 8 Kiosk: Windows 8 Kiosk

Sophie at the Kiosk: Sophie in the Kiosk

Alex at the Kiosk: Alex in the Kiosk

New Dashboard Icons and Cleaner Console JSON Viewer

Today we are excited to introduce two really cool features: Dashboard Icons for Applications and an improved JSON Viewer for Query Console Results. Without further ado, let’s jump to the details:

Introducing Icons in the Dashboard

Dashboard Icons.

Applications can now have their own icon for the Dashboard. This will make it easy to find apps in the dashboard, while also making it beautiful. Choose from 152 beautifully crafted icons by IconDock.

Read on →