Click here to Skip to main content
15,894,410 members

Comments by Akshay malvankar (Top 85 by date)

Akshay malvankar 22-Jan-24 7:26am View    
any one here to help me on this
Akshay malvankar 22-Jan-24 1:56am View    
Can Anyone help me on this
Akshay malvankar 2-Nov-23 1:23am View    
Thank you so much Ansari
Akshay malvankar 30-Oct-23 8:36am View    
I think you misunderstood my problem, read my problem again as I said in my first line I received following response from my API so there is no point for me to debug my code again I shared all thing what I received from API. My code give error from after this line "var responseData = httpresponsemessage.Content.ReadAsStringAsync().Result;"

And Here is my class
public class OutputInfo
{
public string status_id { get; set; }
public string status_msg { get; set; }
public string unique_trans_id { get; set; }
public infodetails info { get; set; }
}

public class infodetails
{
public string case_id { get; set; }
}

Again I shared for you following is my API response

API gives response:
JSON
{
"status_id": 200,
"status_msg": "Successful",
"unique_trans_id": "CLIENTAPI202305260134469",
"info": {
"case_id": "MG.0523.30"
}
}

Sometimes, it gives the following response:
JSON
{
"status_id": 400,
"status_msg": "Bad Request",
"unique_trans_id": "CLIENTAPI202306050146459",
"info": [
"cp_state : value must be a valid string",
"cp_city : value must be a valid string"
]
}

Sometimes, it give response:
JSON
{
"status_id": 409,
"status_msg": "Duplicate Request",
"unique_trans_id": "CLIENTAPI202310270276322",
"info": [
"Duplicate request for reference ID I/2023/400018/00097601"
]
}

now please help me what i should do for above response in code

if (httpresponsemessage.IsSuccessStatusCode)
{
var responseData =
httpresponsemessage.Content.ReadAsStringAsync().Result; /// After this line
strinputjson = responseData.ToString();
ErrorHandler.LogSteps(strinputjson, "JsonOutput");

tResponse =JsonConvert.DeserializeObject<tresponse>
(strinputjson);
}

now I cant explain more then this , I explain and shared all my code my problem and what I want
Akshay malvankar 30-Oct-23 7:34am View    
then what it is?? if is not json ,so how i will identify from above API response ,Info is an array or an object. after this line
var responseData = httpresponsemessage.Content.ReadAsStringAsync().Result;
Please Explain in code