php - Updating a Mapbox dataset via cURL -


i'm new here, though wandered lot in forums, looking answers many questions :)
i'n not coder @ learn myself, , time wanted create mapbox map work. created dataset, 5 polygons property named "status" 3 different values ("high", "medium" , "low"), linked different color. wanted create html/php form access dataset , change status.
according mapbox doc, needs done via curl requests.

i succeded use curl decode mapbox json dataset, designed way :

array (size=4)   'type' => string 'feature' (length=7)   'properties' =>      array (size=1)       'status' => string 'low' (length=3)   'geometry' =>      array (size=2)       'coordinates' =>          array (size=1)           0 =>              array (size=9)               ...   'type' => string 'polygon' (length=7)   'id' => string '21f9760f204c673ede61f96202c005bc' (length=32) 

all i'd edit 'status' from, example, "low" "high". after looking on guides or threads, code :

//the url leads feature want edit (here generic url) $url = "https://api.mapbox.com/datasets/v1/{username}/{dataset_id}/features/{feature_id}?access_token=your-access-token";  $update =array(             'properties'=>array(                                  "status"=>"medium"                                )         );  $data = json_encode($update);  $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_customrequest, 'put'); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_ssl_verifypeer, 0); curl_setopt($ch, curlopt_postfields, $data );  curl_setopt($ch, curlopt_header, true);  $result = curl_exec($ch); curl_close($ch); 

no effect whatsoever. mapbox token allowed write in database. documentation used here (https://www.mapbox.com/api-documentation/#list-features). i'm sure curl code, these options, somewhere wrong, learning curve steep ^^

sorry long subject, , in advance !!


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -