Jump to content


Willkommen im Coresystems Community Forum

Dieses Forum wird nicht mehr weiter betrieben.
Sollten Sie eine Lösung für eine spezifische Aufgabenstellung suchen wenden Sie sich bitte an unseren Support: helpdesk.coresystems.ch.
Für allgemeine Produktinformationen kontaktieren Sie unser Sales-Team: sales@coresystems.ch

Welcome at the coresystems community forum

This forum is no longer being maintained.
If you need a specific solution please contact our support: helpdesk.coresystems.ch.
For general product information do not hesitate to contact our sales team: sales@coresystems.ch

Custom apps using the Coresuite.com API - Part 5

custom apps coresuite API coresuite mobile

  • Please log in to reply
No replies to this topic

#1 Guest_kau_*

Guest_kau_*
  • Guests

Posted 7 May 2015 - 10:04

(Original Blog Post from Adrian Hara, coresuite mobile expert, posted at the 06.06.2014)

 

 

Part 5 – Equipment list

This series of blog posts aims to provide an introduction to using the Coresuite.com API. After reading through it you should have enough confidence to go ahead and build your own app that leverages it. 

 

You can jump to any of the posts in the series here:

 

 

Foreword

The previous post in the series left us off with a functional (and responsive) web application, but without any real data. It’s time to remedy this.

 

To find out how we can get the real data from the Coresuite.com cloud, let’s head over to http://docs.coresuite.com/ and read about it :)

 

As it turns out, it’s pretty simple:

  • The actual data for our company can be stored in any of several Data Server Nodes (e.g. in US, Europe etc) so we first need to find out where it is
  • Once we know which DSN to use we simply make a HTTP GET call to it, appending “/Equipment” as the type of object we’re interested in
  • Additionally for all calls we need to supply some authentication information which, for the sake of brevity, will be the credentials of one of the users we got by email when originally creating the Coresuite.com account

 

Before we get the data though, let’s take a look at (a simplified, from our application’s point of view) conceptual domain model of the Coresuite.com cloud. 

 

Part_5_-_0.PNG

 

“Translated” in our app’s domain model:

  • BusinessPartner – end user of our app, probably a circus manager
  • Equipment – any circus thing (e.g. tent, trampoline etc)
  • ServiceCall – a request for service for a circus thing

 

As you can see, the Equipment is linked to its BusinessPartner and a ServiceCall has links to both the BusinessPartner who requested it and the Equipment for which service is needed.

 

Getting the Equipment data

As described above, we need some “infrastructure” code to find out what the URL of the DSN is before we can actually call it to actually get data. 

Part_5_-_1_new.PNG

 

As documented here http://docs.coresuit.../reference.html we call a specific endpoint on the Master Server Node (MSN), passing in our user’s credentials and we get back an object with information about our company, including its name and DSN URL which we’ll both need for actual data requests.

 

Sidenote: please keep in mind to NEVER store user credentials like this in a production app, as anyone can simply “View Source” of the web page and get access to your data. One good alternative to do it would be to provide a login screen for the user to enter their credentials themselves first or, even better, use some server-side framework like Asp.Net for such purposes.

 

If you’re wondering what “then” means you’ll want to catch up on Javascript Promises. In short, it’s a way to handle asynchronous calls (like a call to the Coresuite.com API) which will take some time and be notified when they are done so you can continue your work.

 

So now that we have the company information, we can call the DSN to get the Equipment data:

Part_5_-_2.PNG

 

The “getAllFromDSN” function is a generic function that we can use to get a list of any kind of object. In our case we call it for “Equipment” and afterwards simply expose the received data on the Scope, to be consumed/displayed in HTML. The data object looks like so:

Part_5_-_3.PNG

 

Showing the Equipment list

If getting the data from the cloud took some doing, showing it is a formality:

Part_5_-_4.PNG

 

Which yields:

Part_5_-_5.PNG

 

This brings us to the end of this part. In the next one we’ll take a look at how to make this list nicer and customize it to better suit our needs.

 







Also tagged with one or more of these keywords: custom apps, coresuite API, coresuite mobile

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users