How to upload a new file to deployment manager via API - jelastic

Looking at jelastic's api documentation but I can't figure out how to upload a file to our deployment manager via API, or fetch those URLs via Jelastic api. Is there a way to do that?
The goal here is to upload a file via API, retrieve that URL and then use the DeployArchive endpoint to upload it to a specific context.
If there's not a way of uploading a file to the deployment manager is there an alternative way of deploying a zip/war to a specific context completely via API?

There is no way to upload files via API to the deployment manager.
To deploy the application to the specific context, you can use following API request:
https://[hoster-api-host]/1.0/environment/control/rest/deployapp?envname=[string]&session=[string]&fileurl=[string]&filename=[string]&context=[string]
where:
envname - the name of the environment, session - your session, fileurl - link to file, filename - name of the archive file, context - given context. If context is not defined then application will be deployed to the ROOT context
More information on this API request can be found in our API documentation Environment -> Control -> DeployApp

Related

How to get the headers from the API on which the application is running using c#

** the application is hosted on server and the API if prodding the headers. I want to read that headers to get the user name (who is accessing the application)**

Unable to deploy service to PCF with no-route

I have this strange issue while pushing one of my application to PCF.
I wants to implement blue-green deployment for my service and I want to deploy app-v2 version with no-route and then add temp route after deployment done.
because I need to bind one marketplace service UAA Single Sign-on(Provides identity capabilities via UAA as a Service) service at application startup time.
This UAA service is causing issue while pushing.
cf command using for deployment
cf push -f manifest-dev.yml --no-route
Error screenshot:
PCF version 2.x
I have a couple ideas that might help to get around this.
Don't use --no-route. You said I want to deploy app-v2 version with no-route and then add temp route after deployment done, so just skip the --no-route part and put the temp route directly into your manifest-dev.yml file. If you already have a route in that file, you could make a copy and call it manifest-dev-v2.yml and put the route there.
Split this up. Remove your service from the manifest-dev.yml file. Run cf push -f manifest-dev.yml --no-route --no-start. Then map the temp route. Then bind the service. Then run cf start. You could alternatively drop the manifest all together, and just script your cf cli actions in a shell script or something like that.
You could look at using one of the blue/green plugins for the cf cli. There's a few and I can't recommend one over another. You can see them all here (search for blue/green).
http://plugins.cloudfoundry.org/
For a little background on the error that's being reported, the authorization code grant (Oauth2) cannot work without a redirect URL. For this flow, a user get's redirected to the login page and then get's redirected back to your redirect URL once login has occurred. Without that redirect URL, users can't complete the flow. It appears to be failing since you don't have any routes and thus cannot have a redirect URL.
Hope that helps!

Handling image uploads in parse.com Cloudcode

I am trying to handle file uploads for a web app through cloud code.I am facing the following issues
We cant add third party middle ware such as busboy to parse
Express' built in function such as req.files doesn't seem to work with the body parser parse.com provides.
I don't want to expose my app key in the client code.
I wanted to know if there is any other way to handle this.
Parse Cloud is not a Node environment so it is not a surprise that it does not support nmp modules.
The middleware Parse provides for express.js does not support file uploads. Instead you need to send the file contents as base64 to your endpoint and create the Parse.File object from this data. more info here
Your app and client keys(except for master key) are PUBLIC INFORMATION and NOT secrets. This is clearly mentioned in the documentation by Parse and you cannot hide them at all. Use CLPs, ACLs and Cloud code to protect your data from unauthorised access.

Passing a file as a parameter for a Spring web service via Postman

I am creating a Spring REST web service for someone who got a client which will use my web service. I have installed the Postman client to test the web service.
One of the web service's parameters is defined as follows:
#RequestParam(value="param2", required=true) MultipartFile param2
I am able to pass strings to the web service but how can I pass a file as a parameter for the web service using Postman? The problem is that many examples I've seen instructing how to do it, had an option to choose a file in the request builder in the form tab. However, in my case there's for some reason a seperate tab for the form and the files and I'm not sure how to give the file I upload a key and add it to the POST parameters.
There are a couple of different ways depending on the type:
1) As form-data
2) As binary

Spring MVC: how secure access to static content with authorization check

I'm currently working on a Spring-MVC web application in which the users can upload files to the server. Those files are saved in the server-side file system and served as static content: my application is deployed on a Tomcat instance and I've added a context in the server.xml file to make them accessible.
Now, I want to secure the access to those files. Basically, a user should only be allowed to access the files he/she uploaded.
What would be the best way to implement this authorization check?

Resources