I have developed courier tracking system,
in i have to insert only tracking number and it detects courier,
After that i have to pass json body to post courier ,
Can any one suggest regarding that???
Solutions will be highly appreciable and thanks in advance..
Here is the code below.. :(
if (TrackingNumber != "")
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://api.aftership.com/v3/trackings);
request.ContentType = "application/json";
request.Method = "POST";
request.Headers.Add("aftership-api-key:*************************");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
if (response.StatusCode == HttpStatusCode.OK)
{
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = null;
if (response.CharacterSet == "")
readStream = new StreamReader(receiveStream);
else
readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet));
// List<string> list = new List<string>();
string data = readStream.ReadToEnd();
.
.
.
.
.
And i want to pass json body like this... :(
{
"tracking": {
"slug": "dhl",
"tracking_number": "123456789",
"title": "Title Name",
}
}
Here only tracking_number is mandatory ,else all fields are optional..... :(