Dear All, Any Expert how can we convert this to API rest consume call
Client client = new Client();
client.ClientName = ClientName;
client.ClientSecret = ClientSecret;
string jsonMessage = JsonConvert.SerializeObject(client);
var content = new StringContent(jsonMessage, Encoding.UTF8, "application/json");
HttpResponseMessage response = await httpClient.PostAsync("urlauthenticate", content);
Hi Aamir,
There is not enough information in your question to help you.
This code uses a framework that exposes objects like Client and httpClient.
The actual REST service is not mentioned in your question.
To consume a REST API in OutSystems please read:
https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/REST/Consume_REST_APIs/Consume_one_or_more_REST_API_methods
or watch:
https://www.youtube.com/watch?v=gNyWIeJYfG0
Regards,
Daniel
Any one please
Give more detailed information will get possible more replies
I need to get token, based on step what steps i will do based on c# code stringcontent in outsystems consume,
i need to convert c# code in outsystems consume call
If you have working C# code you could also decide to create an OutSystems extension, cannot give you a better answer with the limited information you provide.
Simple how can i call about in outsystem rest api
Please find attached i am getting error in outsystems, but when i run c# code above its working fine
In my first reply I already shared how you normally should consume a rest API in OutSystems, all you need is to load the swagger definition of the API and you are good. The Image you provide shows no data that can helps to determine what is your problem. To get proper help please think about sharing the relevant information to figure out what is the problem.
You should take a step back, and read the documentation for the REST service you are trying to consume, then use OutSystems to consume it.
You write you get an error in OutSystems, but include an image of an error in Postman. Are you sure you have the skills to do this project? Is there perhaps a more experienced colleague you can ask to help?
Hi Aamir,In OnBeforeRequest of Rest Api method, assign the json serialized string to RequestText and use post method.
If you need utf-8 encoding you can use TextToBinary extension and then assign to RequestBinary.