public Tracking putTracking(Tracking tracking) throws AftershipAPIException,IOException,ParseException,JSONException{

        String parametersExtra="";
        if(tracking.getId()!=null && !(tracking.getId().compareTo("")==0)){
            parametersExtra = tracking.getId();
        }else {
            String paramRequiredFields = tracking.getQueryRequiredFields().replaceFirst("&", "?");
            parametersExtra = tracking.getSlug()+"/"+tracking.getTrackingNumber()+paramRequiredFields;
        }


        JSONObject response = this.request("PUT", "/trackings/"+parametersExtra, tracking.generatePutJSON());

        return new Tracking(response.getJSONObject("data").getJSONObject("tracking"));

    }