. . .

WebAppUploadModule

Introduction

This module performs the following task:

  1. Upload a web-frontend to the webhosting-module

  2. Automatically put the current apiomat.js-file of the application into the filesystem of the web-fronted deployed on the webhosting-module.

The module works as an post-request as it modifies the content on the server.

The Module depends on the module "Webhosting"

Configuration

Parameter-Name

Typ

Example

Explanation

customer

Query-Paramter

klaus

The name of one valid customer of this server has to be transmitted.

jspath

Query-Parameter

webcontent/scripts/vendor/apiomat/

This indicates the path where the apiomat.js-file should be put into the filesystem of the webhosting-module. For example, let's say you have put your frontend into a zip-file named "webcontent.zip" and you would like to put the apiomat.js into the subfolder "scripts/vendor/apiomat/". Just put the name of the zip-file infront of this path to form "webcontent/scripts/vendor/apiomat/".

-

Binary-Data Body of Post

webcontent.zip

Your webfrontend compressed into a zip-file, transferred as binary data.

The URL to reach the function is:

URL to reach function
<host-base>/yambas/rest/modules/webappuploadmodule/<appname>/spec/upload?customer=<customer>&jspath=<jspath>

Examples

Before using the module, you have to add it to your application via the dashboard.

The Example will be sent with the following parameters:

  • Server-Address: https://epdemo.apiomat.enterprises

  • User-Name: michel@apiomat.com , Password: iAmAPassword

  • Application-Name: Vacation-App

  • System: LIVE

  • Custer-Name: epdemo

  • File to upload: webcontent.zip

  • Path inside the webcontent.zip where the apiomat.js-File should be put: webcontent/build/

    images/download/attachments/10716494/Bildschirmfoto-2017-01-16-um-09.34.08.png

This adds up to the URL:

Example URL
https://epdemo.apiomat.enterprises/yambas/rest/modules/webappuploadmodule/VacationApp/spec/upload?customer=epdemo&jspath=webcontent/build/

Example with Postman

get Postman: https://www.getpostman.com/

1. Authorization

images/download/attachments/10716494/Bildschirmfoto-2017-01-16-um-09.48.40.png

2. Set Headers:

images/download/attachments/10716494/Bildschirmfoto-2017-01-16-um-09.49.06.png

3. Set Body

Here you have to put in the .zip-File with your web-frontend as binary-data!

images/download/attachments/10716494/Bildschirmfoto-2017-01-16-um-09.49.55.png

Example with Java

Using the Apache http-Client library: https://hc.apache.org/httpcomponents-client-ga/index.html .

String url = "https://epdemo.apiomat.enterprises/yambas/rest/modules/webappuploadmodule/VacationApp/spec/upload?customer=epdemo&jspath=webcontent/build/";
String relativePathToWebfrontendZip = "META-INF/webcontent.zip";
String username = michel@apiomat.com;
String password = iAmAPassword;
String apiKey = 123456789;
String system = "LIVE";
 
 
public void post() {
InputStream payLoad = getClass().getResourceAsStream(relativePathToWebfrontendZip);
 
PostMethod request = new PostMethod(url);
 
String credentials = username + ":" + password;
String encoded = new String(Base64.encodeBase64(credentials.getBytes("UTF-8")), "UTF-8");
requestMethod.setRequestHeader("Authorization", "Basic " + encoded);
request.setRequestHeader("ContentType", "application/json");
request.setRequestHeader("x-apiomat-apikey", apiKey);
request.setRequestHeader("x-apiomat-system", system);
 
request.setRequestEntity(new InputStreamRequestEntity(payLoad));
try {
this.client.executeMethod(request);
} catch (IOException e) {
e.printStackTrace();
}
return request;
}

Confirm if upload worked

This step obviously is optional.

  1. Download Filezilla to access the server via FTP ( https://filezilla-project.org/ )

  2. Use Filezilla to connect to the FTP-Server by entering the admin-credentials of your server images/download/attachments/10716494/Bildschirmfoto-2017-01-16-um-16.38.03.png

  3. When connected succesfully, the right panel will show all applications currently deployed on this server. Search for your application

    images/download/attachments/10716494/Bildschirmfoto-2017-01-16-um-16.41.51.png
  4. Open the folder of your application and navigate to the folder which you passed by the "jspath"-variable. There you should find the apiomat.js-file

images/download/attachments/10716494/Bildschirmfoto-2017-01-16-um-11.35.12.png

* link only available in Enterprise Documentation