Editor Improvements

Hi there, we are now pleased to announce that some important features are being implemented in the Application Editor. We’ve planned a set of new features to improve the user experience when it comes to code your apps on iKnode.

One of the major changes is the upgrade of the application editor, this will allow us to extend the editor functionality and features plus the improvements and fixes that come with the upgrade, e.g. you’ll notice you are now able to collapse or expand code blocks.

So as a start we’ve added some key shortcuts for what we consider the most common operations when using the editor, we are talking about saving, compiling and publishing your apps, so here are the key shortcuts you may use when using the editor, for PC and MAC:

  • Save (Ctrl+S, Command+S).
  • Compile (Ctrl+Alt+B, Command+Alt+B).
  • Publish (Ctrl+Alt+P, Command+Alt+P).

As I mentioned, this is just the beginning, we are planning to add more features that make the editor better and easier to use, as an example:

  • Toggle comments blocks.
  • Indent code regions.
  • Search and replace.

Your comments and suggestions are of course more than welcome. More things are on the way, so stay tuned.

Happy Coding!

The iOS SDK

Today we announce the availability of the iOS SDK which enables iOS apps to access your iKnode API. You can download the code @ SDK’s github repository.

The SDKs are built with the purpose of making it easier to access your API through the REST interface. It is not required for you to learn how to use the SDKs at all. Our REST API is very friendly as well, but we do recommend using it; it makes it so much easier.

The SDK follows exactly the same philosophy for all platforms. This means that if you know how to use the Javascript SDK or the C# SDK, the iOS SDK will be a piece of cake.

For this example we are going to use the following API:

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);
        }
  }
}

The model used by the iKnode Application is the following:

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;
        }
    }
}

This API is the same used to demostrate the usage with the Javascript and C# SDKs.

Using just the REST endpoint we would call this API in the following way:

Using curl
1
2
3
4
5
6
curl -X POST \
-H "iKnode-UserId: [YOUR-USERID]" \
-H "iKnode-ApiKey: [YOUR-APIKEY]" \
-H "Content-Type: application/json" \
-d '{ "parameters" : "{ id: \"1\" }" }' \
https://api.iknode.com/Applications/execute/UserSvc/GetById

In the iOS SDK the return type is usually NSDictionary for complex objects as seen in the following example:

Using Objective-C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
ApplicationClient *client = [[ApplicationClient alloc] initWithServiceUrl:BaseUrl
                                                              AndUserId:UserId
                                                                AndApiKey:ApiKey
                                                               AndAppName:@"UserService"];

NSDictionary *params = [NSDictionary dictionaryWithObject:@"1" forKey:@"id"];
NSData *data = [client ExecuteWithMethodName:@"GetById" AndParameters:params];

NSDictionary *user = (NSDictionary *) data;

// User Id
user["Id"];

// User Full Name
user["FullName"];

Hope you find it useful. This SDK, as well as all the others are open source and can be found in here. You can use them as you wish.

Happy New Year 2013!

The iKnode team wishes you a very prosperous new year. We hope that all of your endevours are successful. We are very excited about this new year. We have so many new features and enhancements planned and we know you are going to love them.