The mashup server delivers the content either in XML or in JSON format
On the client side you can parse these responses yourself or use the provided client libraries to parse the responses and provide the results.
Client libraries
TypeScript client library (to be used in Angular apps)
TBD
Java client library
In the Java client library source code from the basic server implementation is used (for the model classes and for the DataSet class) ...
In the communitymashup2 GIT repository (https://athene2.informatik.unibw-muenchen.de/MASH/communitymashup2) there is a directory mashupclient that holds an demonstration Angular app for accessing a mashup service and for displaying the retrieved information. Just load this app and run "ng serve" in the mashupclient directory to run it.
Part of this Angular app is a CommunityMashup2 client library that can be used in other JavaScript/TypeScript frameworks:
For integrating this library follow the following steps: (we are currently working on providing the library as a real Angular library ... but are not there yet)
- In your own Angular project
ng generate service communitymashup/communitymashup - Copy the contents of the communitymashup directory in the mashupclient project to the directory src/app/communitymashup
- Edit the file src/app/app.module.ts:
add the line
Codeblock import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
- add HttpClientModule in the data structure @NgModule...imports: [ ]
- Install the needed libraries:
npm install timers
npm install stream
npm install xml2js - Configure the mashup to load from in src/app/communitymashup/communitymashup.service.ts - in class variable sourceUrl
- See app.component.ts and app.component.html for how to access the mashup API
Java client library
In the communitymashup2 GIT repository (https://athene2.informatik.unibw-muenchen.de/MASH/communitymashup2) there is a package org.sociotech.cm2.client that holds the code for an example client. It uses lots of code from the server to provide a Java representation of a mashup dataset. We do not provide separate client libraries yet, so the best would be to make a JAR file of the whole org.sociotech.cm2 package.
...