Get/post to RESTful web service

You’ll need to add a reference to the MSXML library: Dim sUrl As String Dim response As String Dim xmlhttp Set sUrl = “http://my.domain.com/service/operation/param” Set xmlhttp = Server.CreateObject(“MSXML2.ServerXMLHTTP”) xmlhttp.open “POST”, sURL, False xmlhttp.setRequestHeader “Content-Type”, “application/x-www-form-urlencoded” xmlhttp.send() Dim response As String = xmlhttp.responseText Set xmlhttp = Nothing

Spring boot controller content negotiation

You can use ContentNegotiationConfigurer Firstly, you should override the configureContentNegotiation method in your configuration class: @Configuration @EnableWebMvc public class WebConfig extends WebMvcConfigurerAdapter { @Override public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { configurer.favorPathExtension(false). favorParameter(true). defaultContentType(MediaType.APPLICATION_JSON). mediaType(“xml”, MediaType.APPLICATION_XML); } } favorParameter(true) – enabling favoring path expressions over parameter or accept headers. defaultContentType(MediaType.APPLICATION_JSON) – sets the default content type. this … Read more

How to fetch data server-side in the app directory of Next.js? Tried getStaticProps but it’s returning undefined

Methods like getServerSideProps and getStaticProps are for fetching data on the server but they only work for page components inside the pages folder (the initial way of setting up routes in Next.js). Since Next.js 13, in the app directory we have Server Components, where you can fetch data directly in the component body. In your … Read more

How to make a large file accessible to external APIs?

Returning a File Response First, to return a file that is saved on disk from a FastAPI backend, you could use FileResponse (in case the file was already fully loaded into memory, see here). For example: from fastapi import FastAPI from fastapi.responses import FileResponse some_file_path = “large-video-file.mp4” app = FastAPI() @app.get(“/”) def main(): return FileResponse(some_file_path) … Read more

How to define multiple API endpoints in FastAPI with different paths but the same path parameter?

In FastAPI, as described in this answer, because endpoints are evaluated in order (see FastAPI’s about how order matters), it makes sure that the endpoint you defined first in your app—in this case, that is, /project/{project_id}/…—will be evaluated first. Hence, every time you call one of the other two endpoints, i.e., /project/details/… and /project/metadata/…, the … Read more

Does rest supports arraylist of objects?

Introduce a new class as below @XmlRootElement(name = “responseList”) public class ResposeList { private List<Object> list; public List<Object> getList() { return list; } public void setList(List<Object> list) { this.list = list; } } and set the list as below @GET @Path(“/get”) @Produces(MediaType.APPLICATION_XML) public ResposeList addObjects() { Book book = new Book(); book.setName(“Here is the Game”); … Read more

Upload file from Html form (multipart/form-data) to WCF REST service as a stream without streaming the whole form’s inputs?

Please find some code that might help you to pass a file along with its details in a single call to the REST service: First you would need something called a MultipartParser as shown below: using System; using System.Collections.Generic; using System.IO; using System.Text; using System.Text.RegularExpressions; namespace SampleService { public class MultipartParser { private byte[] requestData; … Read more

Android with Gradle (Java finished with non-zero exit value 2)

I think you should change your java JDK change jvm v8 for jdk7. This link can help you: Is it possible to use Java 8 for Android development? Other possible issue its dependency error, clean gradle before build. And change your jackson library for this: compile ‘com.fasterxml.jackson.core:jackson-databind:2.2.+’ compile ‘com.fasterxml.jackson.core:jackson-core:2.2.+’ compile ‘com.fasterxml.jackson.core:jackson-annotations:2.2.+’