locked
How to pass SqlGeography field parameter from fiddler in webapi call RRS feed

  • Question

  • User-1100884601 posted

    Hi,

    I have a field public SqlGeography Coordinate { get; set; }   which is used in API method.

    I need to pass the value for this field from fiddler/Postman  but format i passing its not taking correctly. 

    "Coordinate":{"Point":[49.259766, -95.616505]} 

     }

    if any one worked on this please share the code .

    Thanks in Advance,

    Wednesday, July 31, 2019 12:57 PM

All replies

  • User475983607 posted

    You did not show us the most important source; the Coordinate object!  Are you using this?

    https://docs.microsoft.com/en-us/dotnet/api/microsoft.sqlserver.types.sqlgeography?view=sql-smo-140.17283.0

    Wednesday, July 31, 2019 1:39 PM
  • User-1100884601 posted

    Hi ,

    Code i already show pasting it again here

    I have a field public SqlGeography Coordinate { get; set; }   which is used in API method.

    I need to pass the value for this field from fiddler/Postman  but format i passing its not taking correctly. 

    "Coordinate":{"Point":[49.259766, -95.616505]} 

     }

    Thursday, August 1, 2019 4:46 AM
  • User475983607 posted

    Hi ,

    Code i already show pasting it again here

    I have a field public SqlGeography Coordinate { get; set; }   which is used in API method.

    I need to pass the value for this field from fiddler/Postman  but format i passing its not taking correctly. 

    "Coordinate":{"Point":[49.259766, -95.616505]} 

     }

    What does "not taking correctly" mean?

    We cannot answer this question accurately without the SqlGeography class structure.  Your JSON format relates to the following C# class.  

        public class SqlGeography
        {
            public Coordinate Coordinate { get; set; }
        }
    
        public class Coordinate
        {
            public float[] Point { get; set; }
        }

    For the second time can you share the SqlGeography class?  If you are using the type linked in my first post then your JSON is incorrect.

    Thursday, August 1, 2019 9:53 AM