Hi Muhamed, thanks for the reply,
I have tried this code but I am getting bad request error, please give me a idea for get the token using json client credentials.
System.Net.HttpWebRequest request; System.IO.Stream stream; System.Exception sysEx; request = System.Net.WebRequest::Create("https://inuat-gateway.c2fo.com/api/integration/v1/token") as System.Net.HttpWebRequest; request.Method = 'POST'; request.ContentType = 'application/json';
// Set the request headers System.Net.WebHeaderCollection headerCollection = request.Headers; headerCollection.Set('Name', 'Value');
var utf8 = System.Text.Encoding::get_UTF8();
// Set the request body
var byteArrayPayload = utf8.GetBytes("{\"ClientId\":\"3haKJrCEFZLULqsfN1tq1F\",\"Clientsecret\":\"6s1l4Xlu3Gq3z4e1w3PRE2pyS7ot8zBH3S70BjgQ9wzt3hQ\"}"); // try // var byteArrayPayload = utf8.GetBytes("{\"ClientId\":\"3haKJrCEFZLULqsfN1tq1F","Clientsecret\":\"6s1l4Xlu3Gq3z4e1w3PRE2pyS7ot8zBH3S70BjgQ9wzt3hQ/dXpF2zpAPahd5tjj\"}"); try { // send out the payload using (System.IO.Stream dataStream = request.GetRequestStream()) { dataStream.Write(byteArrayPayload, 0, byteArrayPayload.Length); }
// request.GetResponse() may already result in an error if the request was e.g. a Bad Request(Status Code 400). This should be handled upstream via our global error handling. using (System.Net.HttpWebResponse response = request.GetResponse() as System.Net.HttpWebResponse) { stream = response.GetResponseStream(); System.IO.StreamReader reader = new System.IO.StreamReader(stream); str responseBody = reader.ReadToEnd(); } } catch (sysEx) { throw; }
System.Net.HttpWebRequest request; System.IO.Stream stream; System.Exception sysEx; request = System.Net.WebRequest::Create("https://inuat-gateway.c2fo.com/api/integration/v1/token") as System.Net.HttpWebRequest; request.Method = 'POST'; request.ContentType = 'application/x-www-form-urlencoded'; request.Accept = '*/*'; // Set the request headers System.Net.WebHeaderCollection headerCollection = request.Headers; var utf8 = System.Text.Encoding::get_UTF8(); var byteArrayPayload = utf8.GetBytes("clientId=3haKJrCEFZLULqsfN1tq1F&clientSecret=6s1l4Xlu3Gq3z4e1w3PRE2pyS7ot8zBH3S70BjgQ9wzt3hQ/dXpF2zpAPahd5tjj"); try { // send out the payload using (System.IO.Stream dataStream = request.GetRequestStream()) { dataStream.Write(byteArrayPayload, 0, byteArrayPayload.Length); } // request.GetResponse() may already result in an error if the request was e.g. a Bad Request(Status Code 400). This should be handled upstream via our global error handling. using (System.Net.HttpWebResponse response = request.GetResponse() as System.Net.HttpWebResponse) { stream = response.GetResponseStream(); System.IO.StreamReader reader = new System.IO.StreamReader(stream); str responseBody = reader.ReadToEnd(); } } catch (sysEx) { throw; }
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CA Neeraj Kumar 2,004
André Arnaud de Cal... 857 Super User 2025 Season 2
Sohaib Cheema 548 User Group Leader