Hi there,

Using Drupal 7 and Services 3 I am able to create a node :
POST http://myurl.com/rest/node - Params : title=test / type=signalement

But I can't get the geofield to get populated :
POST http://myurl.com/rest/node - Params : title=test / type=signalement / field_localise={"und":[{"lat":"2","lon":"3"}]}

I tried to move around braquets, add the "0" array which appear using the devel module, etc.

When I look at a node details in json format through my service, the returned value for my geofield is :
"field_localise":{"und":[{"wkt":"POINT (3 2)","geo_type":"point","lat":"2","lon":"3","left":"3","top":"2","right":"3","bottom":"2","srid":null,"accuracy":null,"source":null}]}

Does anybody had an experience with that ?

Comments

phayes’s picture

Try field_localise={"und":[{"wkt":""POINT (3 2)"}]}

phayes’s picture

phayes’s picture

@Brandonian,

We should also likely make geofield "hunt" for a value to use for it's computations if no master-column was specified:

1. Frist check wkt
2. Then check lat/lon
3. Then check top/bottom/left/right

It would make a lot of this sort of thing seamless.

krem’s picture

Hi there,

Thanks for the replies, but so far no luck...

@Phayes : I had a try but didn't work out, I am also trying to combine the field parameters differently but no success.

If anybody has another proposition, fell free to help ;)
Clem

krem’s picture

I found the problem : ME !

Basically I tried to use Poster (firefox plugin) to POST the service query with my parameters. Long story short, I had to change the 'Content Type' to 'application/json' and the parameters to :
{"uid":"1",
"title":"My test",
"type":"my_type",
"field_localise":
{"und":[{"wkt":"POINT (3 2)"}]}
}

The default 'Content Type' was 'application/x-www-form-urlencoded' and it was converting all special chars to the corresponding ASCII code, that's what messed up the post parameters.

Thanks for the advices anyway ;)

phayes’s picture

Status: Active » Fixed

Sounds like this is resolved then?

krem’s picture

Status: Fixed » Active

Yep ;) Sorry I should have changed the status

Brandonian’s picture

Status: Active » Fixed

Marking as fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.