ices-taf / OHAT

OSPAR HAZARDOUS ASSESSMENT TOOL (OHAT)
https://dome.ices.dk/ohat/
4 stars 0 forks source link

Make TAF controller webservice as POST #22

Closed HansMJ closed 5 days ago

HansMJ commented 3 years ago

Make TAF controller web service a POST so that series, compartment etc are passed as body arguments class for POST body:

After creation in TAF the current GET request to TAF in the AHAT/OHAT/HHAT should be changed to a POST request

This will solve the endless problems when passing spacial characters '%', '/' in the series ID

colinpmillar commented 3 years ago

Here is the object the service is expecting as the body:

  public class ContaminantsAssessmentDto
  {
    public string Series { get; set; } 
    public string Compartment { get; set; }
    public int Year { get; set; }
  }
HansMJ commented 3 years ago

Great, that seems right. Did you already enable the post service?

colinpmillar commented 3 years ago

Something like this should work on your side:

      var json = JsonConvert.SerializeObject(new ContaminantsAssessmentDto { Series = "", Compartment = "", Year = 2020 });
      var body new StringContent(json, Encoding.UTF8, "application/json");

      var resp = await client.PostAsync(url, body);
colinpmillar commented 3 years ago

yes I just published it :) so ready to test

HansMJ commented 3 years ago

Thanks Colin, I will dive into it