SAP S/4HANA Cloud SDK Request language - s4sdk

We are using the SDK to call an API which has localized attributes. Testing this API via POSTMAN if we set the accept-language header we get the localized fields.
Is there a similar way to obtain the localized fields using the ODataQueryBuilder?

You can use the withHeader method of the ODataQueryBuilder.
For SAP S/4HANA, you can provide a sap-language header.

Related

How to use REST API with FaunaDB?

I have created a collection in my Fauna database. I also made an index that returns all the data in that collection. I want to know if there is a way to get JSON REST API to work with this data. What I mean by this is I want a URL that I can 'GET' using XMLHttpRequest and then parse into JSON.
You might say that Fauna is "HTTP native". All of the language drivers (JS, C#, Python, etc.) are built on top of http requests. That is, there are no special connections or connection-pools to maintain. You can get pretty far with using the JS driver in the browser, for example, without using a server.
But to answer your question more directly, there are many ways to serve a REST API, and it is going to depend on how you want to serve the API.
Examples
AWS
Here is a blog post on how to set up a REST API with AWS App Runner, for example.
https://fauna.com/blog/deploying-a-rest-api-with-aws-app-runner-and-fauna
Vercel and Netlify
There are also some example apps on github that demonstrate using a REST API with
Vercel:
https://github.com/vercel/next.js/tree/canary/examples/with-cookie-auth-fauna
Or Netlify:
https://github.com/netlify/netlify-faunadb-example
Both of which host serverless functions for you to create a REST API.

Serverless Framework with lambda-proxy integation and API Model Validation

I have an issue validating a request with a model when the user changes the content-type of the request in a serverless framework lambda-proxy integration
As per AWS docs, we can not change too much when using lambda-proxy integration
For example, the passthrough behavior that explains what happens when a validation model does not match the request type, can not be used on lambda-proxy integration.
My problem: I want to reject all requests that are not JSON so they must be forced to use the model validation. But at the same time, I do not want to change the integration type from lambda-proxy to lambda.
What can I do to solve this issue?
BR
One thing you can do is inspect the headers in the event object to confirm that it is the type you expect and if not return an error:
https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway.html
We can enforce the Content-Type header straight into the API Gateway like below.
References can be found here: https://docs.aws.amazon.com/apigateway/latest/developerguide/request-response-data-mappings.html

How Should I Make Spring Boot Rest API's Return Response in Client Requested Formate

I have Spring boot Rest APIS, but i want make those APIS Response as per the Client Requested Format.
For Instance :
Rest APIS Return Response By default In Json format. But Client Want to in XML formate or any other formate.
In the above situation how can i make my APIS dynamically Retunr the Response as per the Client requested format.
can any tell how can i do this.
Thanks in advance.
What you are talking about is Content Negotiation - Here's a Baeldung article that describes how you might use Jackson libraries to handle both XML and JSON data,
https://www.baeldung.com/spring-mvc-content-negotiation-json-xml
You need to devise a content negotiation strategy - very often, that is the use of the Accept header. Your API then has to respect this header and return the appropriate content, which might mean your API contracts having certain attributes to allow it to easily serialize to JSON/XML.
The article linked above links to a github repo that shows how this might be achieved - https://github.com/eugenp/tutorials/tree/master/spring-mvc-basics

how to use the proxy service without tryit tool in wso2 esb?

I am learning and working on building some wso2 sample prototypes.
I have created a proxy service and tried using it with the tryit tool inside.
But i don't know how to use it externally. i mean how to send data to the proxy service because in API there is a endpoint created where the request is sent.
Is there anything like link to request or how to use it externally in some application.
You can use SOAP UI. Please check the article.
The easiest way to call Your proxy service is to use some Rest Client on Your Browser. I use Add-On in Firefox (RestClient i think). U can create there whole request (json, xml), add headers, Authentications or Content Type. It should helps U to call any services in wso2.

How to send headers using Postclient library in windows phone

I am sending post parameters in Windows Phone app using PostClient library. I want to add some headers to URL. How to do this?
As I see you can't do that directly via library. You should download source code and add this functionality by self.
It's pretty easy, because library is very small. They use HttpWebRequest to send the data and this class have a property - Headers. It's just a collection of name/value pairs. Add a collection into the class, add methods to access this collection and process this collection(add the headers from it) before the library sends requests.

Resources