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
Comment #1
phayes commentedTry
field_localise={"und":[{"wkt":""POINT (3 2)"}]}Comment #2
phayes commentedSee also: http://en.wikipedia.org/wiki/Well-known_text
Comment #3
phayes commented@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.
Comment #4
krem commentedHi 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
Comment #5
krem commentedI 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 ;)
Comment #6
phayes commentedSounds like this is resolved then?
Comment #7
krem commentedYep ;) Sorry I should have changed the status
Comment #8
Brandonian commentedMarking as fixed.