/// <summary>
        /// Monitor external package; generate webhook.
        /// </summary>
        /// <returns>ExternalPackageResponse or null.</returns>
        public static ExternalPackageResponse MonitorExternalPackage(ExternalPackage webhook)
        {
            // serialize shipment
            string postBody = JsonConvert.SerializeObject(webhook,
                new JsonSerializerSettings {DefaultValueHandling = DefaultValueHandling.Ignore});

            // https://api.postmaster.io/v1/track
            string url = "{0}/{1}/{2}";
            url = string.Format(url, Config.BaseUri, Config.Version, Resource);

            string response = Request.Post(url, postBody);

            return response != null ? JsonConvert.DeserializeObject<ExternalPackageResponse>(response) : null;
        }
Exemple #2
0
        /// <summary>
        /// Monitor external package; generate webhook.
        /// </summary>
        /// <returns>ExternalPackageResponse or null.</returns>
        public static ExternalPackageResponse MonitorExternalPackage(ExternalPackage webhook)
        {
            // serialize shipment
            string postBody = JsonConvert.SerializeObject(webhook,
                                                          new JsonSerializerSettings {
                DefaultValueHandling = DefaultValueHandling.Ignore
            });

            // https://api.postmaster.io/v1/track
            string url = "{0}/{1}/{2}";

            url = string.Format(url, Config.BaseUri, Config.Version, Resource);

            string response = Request.Post(url, postBody);

            return(response != null?JsonConvert.DeserializeObject <ExternalPackageResponse>(response) : null);
        }