Working with Data

Getting Data using a browser

This mostly proves the service can be reached. There probably is no real life application here, but it does provide troubleshooting help.

browser

Unfortunately there is no pretty json option, but XML is available which renders better when viewing data like this:

browser 2

Getting Data using javascript

There are many different methods of getting the data using javascript and a lot of helper libraries out there. These samples use jQuery and one of the lower level functions called .ajax. Because of cross origin concerns, the jQuery.support.cors variable is set to true so that jQuery knows that it is okay to send an http request to a server other than the one serving up this web page.

getting with javascript

Posting Data (creating data) using javascript

Posting Data using Javascript

Putting Data (updating data) using javascript

Putting Data using javascript

Getting Data using C#

There are also several ways to make HTTP requests with C#. The following gets a list of requests and outputs it to the console window (it will show up as a mess of XML text). It will only return the 10 most recent requests.

getting data with c

This is not ideal for working with the data, so a better way is to deserialize the XML into an object that you can work with. We can provide these basic objects to make it easier to work with the data client side. Here is an example partial object:

getting data with c 2

The objects we provide also include some attributes that assist with serialization not shown in the above clip. They are included in a series of C# projects (or compiled dlls) called Lucity.*.SerializationObjects.

These objects are current as of whenever you downloaded them from our site. It is not necessary to update these client side objects with each release. You only need to update the objects if there is a new property you want to take advantage of in the new release.

The following example uses WebClient instead of HttpClient and deserializes the data into a collection object and then binds a grid on a windows form to the collection. This is part of SimpleWindowsFormsWorkOrderSample in the DesktopSamples solution.

get data with c

Posting (Creating) Data using C#

This example creates a Request object (available in the Lucity.Work.Serialization project or assembly) and serializes it posting the data to the server to create a new request. The results of the operation are written to a list box called Results. This sample is part of SimpleWindowsFormsWorkOrderSample in the DesktopSamples solution.

Posting Data using C

There are many more samples including asynchronous options and WPF available in the DesktopSamples Solution.

See Also

Welcome

Installation and Configuration

Basics

Key Concepts

Special Functions

Other Notes