Updating a topic Location via API

Hi everyone,

Re Locations plugin - I’m hoping this is the right place for support? Please point me in the right direction if not :blush:

I’m trying to update the location of an existing Topic via the API but it doesn’t appear to be working. Is there any documentation for this?

Currently I can add a new Topic via the API and also include a Location (lat/lng) at the same time using:

strServiceURL &= "&location={""geo_location"": {""lat"": """ & Session("AddLocactionLAT") & """,""lon"": """ & Session("AddLocactionLNG") & """,""address"": """ & strRegionName & """},""name"": """"}"

This works fine, no problem :+1:t2:

But when I edit a Topic (i.e. a discourse Post ID) via the API the Location doesn’t update.

I’m appending the same code to the url/endpoing:

Dim strServiceURL As String = "https://MY.DOMAIN/posts/" & intGADCPostID & ".json"

strServiceURL &= "?post[raw]=" & strBody

strServiceURL &= "&location={""geo_location"": {""lat"": """ & Session("AddLocactionLAT") & """,""lon"": """ & Session("AddLocactionLNG") & """,""address"": """ & strRegionName & """},""name"": """"}"

When I use this method above, the post body/content changes correctly but the Location remains exactly as it was before.

Am I doing something wrong here? :thinking:

I also tried updating the Topic ID itself (which I think is where this should be performed, not on the Post ID).

I’m currently using this to edit a Topic Title and it’s Category:

Dim strServiceURL As String = "https://MY.DOMAIN/t/" & strSlugTitle & "/" & intGADCTopicID & ".json"

strServiceURL &= "?title=" & strTitle

strServiceURL &= "&category_id=30"

That updates my topic title text and changes the category of the topic, all fine :+1:t2:

But when I try and append this on the end, I get some critical errors:

strServiceURL &= "&location={""geo_location"": {""lat"": ""52.12345"",""lon"": ""-2.8321"",""address"": ""test region""},""name"": ""some name here""}"

(ignore the double quotes, they’re fine, it’s just the way vb.net handles the escapes)

I’m confused, as when I create a new topic with a location attached to it, I use this exact same method and it works fine.

What am I doing wrong here guys? :thinking: