Posts

Showing posts with the label rest

two way webservice communication REST

Image
Clash Royale CLAN TAG #URR8PPP two way webservice communication REST G'day folks, So I have an application in mind with a client-server architecture where multiple clients are connected to a web service. The webservice needs to be able to call or send messages to all or some of the clients. I have previously done the same using SOAP based services in WCF but now I am working with java and wish to avoid SOAP. I have been experimenting with Server Sent Events in reactive framework in Spring framework but have been mostly unlucky. Is there a way to implement two way communication without explicitly exposing a webservice or such on the client? thanks a bunch :) 1 Answer 1 Try WebSockets for two-way communication and simple Restful for request-response communication. Here is a simple guide: http://www.baeldung.com/java-websockets By clicking "Post Your...

DocuSign and Manage Service Desk Plus Integration

Image
Clash Royale CLAN TAG #URR8PPP DocuSign and Manage Service Desk Plus Integration I need some guidance for integrating DocuSign and Service Desk Plus. This will be my first time working with APIs. I would like to have Manage Engine Service Desk Plus (SDP) send information over to DocuSign. This information will then be used to create a PDF that will be sent by DocuSign to a user. So far I have been using Postman's POST function to pull the information I need from SDP. I have also used the same function to create envelopes and send envelopes with DocuSign. I am unable to understand how to get the information I retrieved using Postman from SDP to DocuSign. Please let me know if there is any other information that I can provide. 1 Answer 1 Good work on getting the data you want out of Service Desk by using Postman. That is an important first step. Next, choose a software language (I suggest a script...

Spring Rest Api Design For Following a User in Twitter Clone Appliction?

Image
Clash Royale CLAN TAG #URR8PPP Spring Rest Api Design For Following a User in Twitter Clone Appliction? i Want to Design a Demo Twitter Clone Application where user can follow any other user . however i am doubting my rest api design . please suggest me am i right . can we pass followerId in url rather than passing it as requestbody ? and if better option could be there like put/patch or any rest api design ? Here JwtUser is Authenticated User public class FollowerDto { @NotBlank private Long followerId; private boolean following; public FollowerDto() { } public FollowerDto(Long followerId, boolean following) { this.followerId = followerId; this.following = following; } public boolean getFollowing() { return following; } public void setFollowing(boolean following) { this.following = following; } public Long getFollowerId() { return followerId; } public void setFollowerId(Long followerId) { this.followerId = followerId; } } @PostMapping("/follower"...

Service Reference error upon creation

Image
Clash Royale CLAN TAG #URR8PPP Service Reference error upon creation I'm currently having an issue with adding an OData service in a C# project. The service looks like this. My step by step process looks like this: STEP 1: Entering the OData URL STEP 2: After hitting OK, the following error pops up. STEP 3: Trying to update the service ----> Which results in following error. I can't seem to figure out what causes these issues. If anyone has any suggestions, please let me know. It would be greatly appreciated! 1 Answer 1 Instead of using the service reference with UWP. I used Ajax calls to get the data. Some of them weren't allowed in a Unity build. This is why I used tags to exclude scripts like this: #if (UNITY_EDITOR) ... your class/code ... #endif More information about this can be found by following this url. https://support.unity3d.com/hc/en-us/articles/208456906-Excluding-Script...

Java Jira HTTP response code 403

Image
Clash Royale CLAN TAG #URR8PPP Java Jira HTTP response code 403 I'm trying to get some data by the rest api of Jira. Thiw website is locally in my enterprise and on https. The first time we go on it we are automatically login by SSO. There are certificats too. I have check all post about this error, try with User-Agent or TrustManager but nothing work :( then I can access to the page by my browser without any problem. It's work on two other computer and I didn't really understand why. Error I got : java.io.IOException: Server returned HTTP response code: 403 for URL: https://myjira.xx/rest/api/2/search?jql=project=PARE2+order+by+updated&fields=id,updated,summary,assignee,worklog&startAt=0&maxResults=30 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) And my code is : public void connectToJira() throws Exception { String adre...

how do i process a file while making a flask server?

Image
Clash Royale CLAN TAG #URR8PPP how do i process a file while making a flask server? I have my code her. I was wondering how do I get this file to even be recognized or saved as a local variable in the Python code? (the file is a csv btw). Here is the image from flask import Flask from flask_restful import Api, Resource, reqparse app = Flask(__name__) api = Api(app) class Dataframe(Resource): def post(self, name): parser = reqparse.RequestParser() parser.add_argument("data") args = parser.parse_args()[enter image description here][1] return args, 201 api.add_resource(Dataframe, "/<string:name>") app.run(debug=True) By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Java Jersey How to Upload File with the File as Parameter

Image
Clash Royale CLAN TAG #URR8PPP Java Jersey How to Upload File with the File as Parameter I have a method in the resource class, uploadFile. It calls a method that takes in a file as a parameter and then split the files into parts before writing said parts to disk. I would like to know how to write a client test for it, assuming it's possible to upload a file without using @FormDataParam InputStream. Because I don't think I need it in this case. I've seen plenty of examples for uploading files with Jersey that takes in InputStream and FormDataContentDisposition as @FormDataParam but I'm not sure if that's mandatory. @POST @Path("/uploadfile/{file}") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response uploadFile(@PathParam("file") File file, @FormDataParam("file") FormDataContentDisposition fileMetaData) throws IOException { FileSplit.splitFile(file); //Write file to disk String output = "File successfully uploaded"...

Java ee api rest error: java.lang.IllegalArgumentException

Image
Clash Royale CLAN TAG #URR8PPP Java ee api rest error: java.lang.IllegalArgumentException I'm creating a api rest with Tomcat 7.0 + Maven + Java EE + JDK 10.0.2 in eclipse and I got this error: Error: HTTP Status 500 - Servlet.init() for servlet api threw exception type Exception report message Servlet.init() for servlet api threw exception description The server encountered an internal error that prevented it from fulfilling this request. exception javax.servlet.ServletException: Servlet.init() for servlet api threw exception org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041) org.apache.coyote.AbstractP...

REST API Designs with categories

Image
Clash Royale CLAN TAG #URR8PPP REST API Designs with categories Let's say there is a SINGLE mobile application which receives various types of notifications (like WhatsApp notifications, Facebook Messenger notifications ,etc). What would be a better REST API structure for this? /users/test@abc.com/notifications //Gives all the notifications There is a confusion between the below two formats on how . /users/test@abc.com/notifications?category=whatsapp,facebook //Gives all the notifications vs /users/test@abc.com/notifications/whatsapp //Gives only whatsapp notification /users/test@abc.com/notifications/facebook //Gives only facebook notification To access an individual notification resource /users/test@abc.com/notifications/facebook/{notification-id} vs /users/test@abc.com/notifications/{notification-id} Have you had a look at this: stackoverflow.com/questions/24059773/… – M20 5 hours ago ...

Jersey: where does LogginFeature log?

Image
Clash Royale CLAN TAG #URR8PPP Jersey: where does LogginFeature log? I have a Jersey 2.23 running inside of a glassfish/grizzly webserver. That is working well. Now I try to enable LoggingFeture for logging any access to the service. ResourceConfig rc = new ResourceConfig (); rc.packages (MyProg.class.getPackage ().getName ()); rc.register (LoggingFeature.class); rc.property(LoggingFeature.LOGGING_FEATURE_LOGGER_LEVEL_SERVER, "INFO"); rc.property(LoggingFeature.LOGGING_FEATURE_VERBOSITY_SERVER, LoggingFeature.Verbosity.HEADERS_ONLY); HttpServer hs = GrizzlyHttpServerFactory.createHttpServer (URI.create ("http://myserver"), rc); I do not find any new files where it puts the logs in my apps dir or in /var/log. If someone can please explain to me if my code is ok and where to look. I would expect a file where it puts a line for any new request to the server (like access.log of Apache) Thanks! By...

Rest Api with node.js localhost not answering

Image
Clash Royale CLAN TAG #URR8PPP Rest Api with node.js localhost not answering Hy there, I'm trying to learn to make a REST API. I have the following code, where I mention that i have no error. When I try to access localhost:3000 nothing happens it's just reloading a blank page. What am I doing wrong? localhost:3000 Servers.js const http = require('http'); const app = require('./app').default; const port = process.env.port || 3000; const server = http.createServer(); server.listen(port); App.js const express = require('express'); const app = express(); app.use((req, res, next) => { res.status(200).json({ message: 'It works!' }); }); module.exports = app; 1 Answer 1 You've not defined any route. Express generator generates the boilerplate code which is use full to start with. You can also define a route like this: app.use('/', functio...

How to return more than 50 results from Dynamics 365 using the Web API

Image
Clash Royale CLAN TAG #URR8PPP How to return more than 50 results from Dynamics 365 using the Web API Continuing on with my Dynamics 365 from Delphi project, I am now at a point where I need to be retrieving more data from CRM than the 50 entities I can get by default, and that by setting the maxpagesize preference, I should be able to get more. This is what my existing Delphi code looks like to retrieve the data from Dynamics: RESTClient.BaseURL := 'https://mytest.api.crm6.dynamics.com'; RESTRequest.Resource := 'XRMServices/2011/OrganizationData.svc/AccountSet?$select=Name&'; RESTRequest.Accept := 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8'; RESTRequest.Execute; This returns 50 results, and follows up with the paging tag (which we will ignore for now): <link rel="next" href="https://mytest.api.crm6.dynamics.com/XRMServices/2011/OrganizationData.svc/AccountSet?$select=Name&amp;$skiptok...