Re: [OSM-dev] Using API 0.6 to create a new node

2016-06-15 Thread Bryan Housel
To create a changeset you need change your xml_string too, not just the 
endpoint.

see the example here:
http://wiki.openstreetmap.org/wiki/API_v0.6#Update:_PUT_.2Fapi.2F0.6.2Fchangeset.2F.23id
 




> On Jun 15, 2016, at 5:37 AM, toni hernández  wrote:
> 
> Net yet..hopefully soon.
> 
> Sorry to be so persistent...but.. 
> I am still getting a 401 Unauthorized error when sending the changeset create 
> request.
> 
> Do I need to include the auth token in the header AJAX call? 
> 
> This is how I try to create a new changeset:
> 
> var xml_string = '  generator="MyOpenstreetmapApp"> lon="2.816094">';
> 
> ajaxurl= "http://master.apis.dev.openstreetmap.org/api/0.6/changeset/create; 
> ;
> 
> $.ajax({
> url: ajaxurl,
> data: xml_new_changeset, 
> type: 'PUT',
> contentType: "text/xml",
> dataType: "text",
> success : function (resp){console.debug(resp)},
> error : function (xhr, ajaxOptions, thrownError){  
> console.log(xhr.status);  
> console.log(thrownError);
> } 
> });   
> 
> 
> Toni Hernández Vallès 
> Servei de Sistemes d'Informació Geogràfica i Teledetecció
> -
> Universitat de Girona
> SIGTE
> -
> Pl. Ferrater Mora 1
> 17071 Girona
> Tel +34 972 418 039 (7026 intern)
> t...@sigte.udg.edu  
> 
> http://www.sigte.udg.edu 
> Twitter http://twitter.com/SIGTE_UDG 
> 
> On 15/06/2016 11:20, Christian Ledermann wrote:
>> If you can read python have a look at:
>> 
>> https://github.com/cleder/osmoapi 
>> 
>> On 15 June 2016 at 09:57, Paul Norman  
>>  wrote:
>>> On 6/14/2016 8:41 AM, toni hernández wrote:
>>> 
>>> Hi everyone,
>>> 
>>> I am trying to display OSM data into my web map as well as other custom
>>> layers.
>>> One of the goals of my web application is to upload data from my application
>>> to the osm database.  I have been reading this
>>> http://wiki.openstreetmap.org/wiki/API_v0.6#Elements 
>>>  but still I do not
>>> understand how a PUT request functions. I have so much to learn
>>> 
>>> After authentificating with osmauth.js I try this code without any success.
>>> I get a 401 error.
>>> 
>>> var xml_string = ' >> generator="MyOpenstreetmapApp">>> lon="2.816094">';
>>> 
>>> ajaxurl= "http://www.openstreetmap.org/api/0.6/node/create; 
>>> ;
>>> 
>>> 
>>> I do not recommend the node/create API endpoint. Instead, use the diff
>>> upload API call documented at
>>> http://wiki.openstreetmap.org/wiki/API_v0.6#Diff_upload:_POST_.2Fapi.2F0.6.2Fchangeset.2F.23id.2Fupload
>>>  
>>> .
>>> 
>>> You will have to use this endpoint anyways for modifying existing data.
>>> 
>>> ___
>>> dev mailing list
>>> dev@openstreetmap.org 
>>> https://lists.openstreetmap.org/listinfo/dev 
>>> 
>>> 
>> 
>> 
> 
> ___
> dev mailing list
> dev@openstreetmap.org
> https://lists.openstreetmap.org/listinfo/dev

___
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Using API 0.6 to create a new node

2016-06-15 Thread Christian Ledermann
see http://oauth.net/code/

On 15 June 2016 at 12:54, Tom Hughes  wrote:
> On 15/06/16 12:37, Christian Ledermann wrote:
>
>> yes you either have to include the oAuth token or the username:password
>
>
> It's not just a question of "including a token" but rather you have to
> properly sign the request according to the OAuth protocol.
>
> Tom
>
> --
> Tom Hughes (t...@compton.nu)
> http://compton.nu/



-- 
Best Regards,

Christian Ledermann

Newark-on-Trent - UK
Mobile : +44 7474997517

https://uk.linkedin.com/in/christianledermann
https://github.com/cleder/


<*)))>{

If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.

1) Don’t drive species to extinction

2) Don’t destroy a habitat that species rely on.

3) Don’t change the climate in ways that will result in the above.

}<(((*>

___
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Using API 0.6 to create a new node

2016-06-15 Thread Tom Hughes

On 15/06/16 12:37, Christian Ledermann wrote:


yes you either have to include the oAuth token or the username:password


It's not just a question of "including a token" but rather you have to 
properly sign the request according to the OAuth protocol.


Tom

--
Tom Hughes (t...@compton.nu)
http://compton.nu/

___
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Using API 0.6 to create a new node

2016-06-15 Thread Christian Ledermann
yes you either have to include the oAuth token or the username:password

On 15 June 2016 at 10:37, toni hernández  wrote:
> Net yet..hopefully soon.
>
> Sorry to be so persistent...but..
> I am still getting a 401 Unauthorized error when sending the changeset
> create request.
>
> Do I need to include the auth token in the header AJAX call?
>
> This is how I try to create a new changeset:
>
> var xml_string = '  generator="MyOpenstreetmapApp"> lon="2.816094">';
>
> ajaxurl=
> "http://master.apis.dev.openstreetmap.org/api/0.6/changeset/create;;
>
> $.ajax({
> url: ajaxurl,
> data: xml_new_changeset,
> type: 'PUT',
> contentType: "text/xml",
> dataType: "text",
> success : function (resp){console.debug(resp)},
> error : function (xhr, ajaxOptions, thrownError){
> console.log(xhr.status);
> console.log(thrownError);
> }
> });
>
>
> Toni Hernández Vallès
> Servei de Sistemes d'Informació Geogràfica i Teledetecció
> -
> Universitat de Girona
> SIGTE
> -
> Pl. Ferrater Mora 1
> 17071 Girona
> Tel +34 972 418 039 (7026 intern)
> t...@sigte.udg.edu
>
> http://www.sigte.udg.edu
> Twitter http://twitter.com/SIGTE_UDG
>
> On 15/06/2016 11:20, Christian Ledermann wrote:
>
> If you can read python have a look at:
>
> https://github.com/cleder/osmoapi
>
> On 15 June 2016 at 09:57, Paul Norman  wrote:
>
> On 6/14/2016 8:41 AM, toni hernández wrote:
>
> Hi everyone,
>
> I am trying to display OSM data into my web map as well as other custom
> layers.
> One of the goals of my web application is to upload data from my application
> to the osm database.  I have been reading this
> http://wiki.openstreetmap.org/wiki/API_v0.6#Elements but still I do not
> understand how a PUT request functions. I have so much to learn
>
> After authentificating with osmauth.js I try this code without any success.
> I get a 401 error.
>
> var xml_string = '  generator="MyOpenstreetmapApp"> lon="2.816094">';
>
> ajaxurl= "http://www.openstreetmap.org/api/0.6/node/create;;
>
>
> I do not recommend the node/create API endpoint. Instead, use the diff
> upload API call documented at
> http://wiki.openstreetmap.org/wiki/API_v0.6#Diff_upload:_POST_.2Fapi.2F0.6.2Fchangeset.2F.23id.2Fupload.
>
> You will have to use this endpoint anyways for modifying existing data.
>
> ___
> dev mailing list
> dev@openstreetmap.org
> https://lists.openstreetmap.org/listinfo/dev
>
>
>
>
>
> ___
> dev mailing list
> dev@openstreetmap.org
> https://lists.openstreetmap.org/listinfo/dev
>



-- 
Best Regards,

Christian Ledermann

Newark-on-Trent - UK
Mobile : +44 7474997517

https://uk.linkedin.com/in/christianledermann
https://github.com/cleder/


<*)))>{

If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.

1) Don’t drive species to extinction

2) Don’t destroy a habitat that species rely on.

3) Don’t change the climate in ways that will result in the above.

}<(((*>

___
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Using API 0.6 to create a new node

2016-06-15 Thread toni hernández

Net yet..hopefully soon.

Sorry to be so persistent...but..
I am still getting a 401 Unauthorized error when sending the changeset 
create request.


Do I need to include the auth token in the header AJAX call?

This is how I try to create a new changeset:

var xml_string = ' version="0.6" generator="MyOpenstreetmapApp">lat="41.983910" lon="2.816094">v="supermarket"/>';


ajaxurl= 
"http://master.apis.dev.openstreetmap.org/api/0.6/changeset/create;;


$.ajax({
url: ajaxurl,
data: xml_new_changeset,
type: 'PUT',
contentType: "text/xml",
dataType: "text",
success : function (resp){console.debug(resp)},
error : function (xhr, ajaxOptions, thrownError){
console.log(xhr.status);
console.log(thrownError);
}
});


*Toni Hernández Vallès*
Servei de Sistemes d'Informació Geogràfica i Teledetecció
-
Universitat de Girona
*SIGTE*
-
Pl. Ferrater Mora 1
17071 Girona
Tel +34 972 418 039 (7026 intern)
t...@sigte.udg.edu 

http://www.sigte.udg.edu
Twitter http://twitter.com/SIGTE_UDG

On 15/06/2016 11:20, Christian Ledermann wrote:

If you can read python have a look at:

https://github.com/cleder/osmoapi

On 15 June 2016 at 09:57, Paul Norman  wrote:

On 6/14/2016 8:41 AM, toni hernández wrote:

Hi everyone,

I am trying to display OSM data into my web map as well as other custom
layers.
One of the goals of my web application is to upload data from my application
to the osm database.  I have been reading this
http://wiki.openstreetmap.org/wiki/API_v0.6#Elements but still I do not
understand how a PUT request functions. I have so much to learn

After authentificating with osmauth.js I try this code without any success.
I get a 401 error.

var xml_string = ' ';

ajaxurl= "http://www.openstreetmap.org/api/0.6/node/create;;


I do not recommend the node/create API endpoint. Instead, use the diff
upload API call documented at
http://wiki.openstreetmap.org/wiki/API_v0.6#Diff_upload:_POST_.2Fapi.2F0.6.2Fchangeset.2F.23id.2Fupload.

You will have to use this endpoint anyways for modifying existing data.

___
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev






___
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Using API 0.6 to create a new node

2016-06-15 Thread Christian Ledermann
If you can read python have a look at:

https://github.com/cleder/osmoapi

On 15 June 2016 at 09:57, Paul Norman  wrote:
> On 6/14/2016 8:41 AM, toni hernández wrote:
>
> Hi everyone,
>
> I am trying to display OSM data into my web map as well as other custom
> layers.
> One of the goals of my web application is to upload data from my application
> to the osm database.  I have been reading this
> http://wiki.openstreetmap.org/wiki/API_v0.6#Elements but still I do not
> understand how a PUT request functions. I have so much to learn
>
> After authentificating with osmauth.js I try this code without any success.
> I get a 401 error.
>
> var xml_string = '  generator="MyOpenstreetmapApp"> lon="2.816094">';
>
> ajaxurl= "http://www.openstreetmap.org/api/0.6/node/create;;
>
>
> I do not recommend the node/create API endpoint. Instead, use the diff
> upload API call documented at
> http://wiki.openstreetmap.org/wiki/API_v0.6#Diff_upload:_POST_.2Fapi.2F0.6.2Fchangeset.2F.23id.2Fupload.
>
> You will have to use this endpoint anyways for modifying existing data.
>
> ___
> dev mailing list
> dev@openstreetmap.org
> https://lists.openstreetmap.org/listinfo/dev
>



-- 
Best Regards,

Christian Ledermann

Newark-on-Trent - UK
Mobile : +44 7474997517

https://uk.linkedin.com/in/christianledermann
https://github.com/cleder/


<*)))>{

If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.

1) Don’t drive species to extinction

2) Don’t destroy a habitat that species rely on.

3) Don’t change the climate in ways that will result in the above.

}<(((*>

___
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Using API 0.6 to create a new node

2016-06-15 Thread Paul Norman

On 6/14/2016 8:41 AM, toni hernández wrote:

Hi everyone,

I am trying to display OSM data into my web map as well as other 
custom layers.
One of the goals of my web application is to upload data from my 
application to the osm database.  I have been reading this 
http://wiki.openstreetmap.org/wiki/API_v0.6#Elements but still I do 
not understand how a PUT request functions. I have so much to learn


After authentificating with osmauth.js I try this code without any 
success. I get a 401 error.


var xml_string = ' version="0.6" generator="MyOpenstreetmapApp">lat="41.983910" lon="2.816094">v="supermarket"/>';


ajaxurl= "http://www.openstreetmap.org/api/0.6/node/create;; 


I do not recommend the node/create API endpoint. Instead, use the diff 
upload API call documented at 
http://wiki.openstreetmap.org/wiki/API_v0.6#Diff_upload:_POST_.2Fapi.2F0.6.2Fchangeset.2F.23id.2Fupload.


You will have to use this endpoint anyways for modifying existing data.
___
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Using API 0.6 to create a new node

2016-06-15 Thread toni hernández

I will. I promise. :)
And I will also use the dev server.

It is just a pilot application for my city (Girona, Spain) and just for 
nodes related with bike activity.

Thank you all.
I love osm.

*Toni Hernández Vallès*
Servei de Sistemes d'Informació Geogràfica i Teledetecció
-
Universitat de Girona
*SIGTE*
-
Pl. Ferrater Mora 1
17071 Girona
Tel +34 972 418 039 (7026 intern)
t...@sigte.udg.edu 

http://www.sigte.udg.edu
Twitter http://twitter.com/SIGTE_UDG

On 14/06/2016 18:48, Simon Poole wrote:



And please (please please please) -do- check existing data before you 
upload.


Am 14.06.2016 um 18:31 schrieb Ian Dees:
Also, don't forget to use the dev server to do your testing so you 
don't accidentally create bad data in the real database. The URL is 
http://master.apis.dev.openstreetmap.org/.


On Tue, Jun 14, 2016 at 12:13 PM Bryan Housel > wrote:


You can’t just pass “0” as the changeset id.

Your app will need to create a changeset first with :

http://wiki.openstreetmap.org/wiki/API_v0.6#Create:_PUT_.2Fapi.2F0.6.2Fchangeset.2Fcreate

This diagram talks a bit about the flow of how to create a
changeset, issue updates against it, then close the changeset:

http://wiki.openstreetmap.org/wiki/File:OSM_API0.6_Changeset_successful_creation_V0.1.png





On Jun 14, 2016, at 11:41 AM, toni hernández
 wrote:

Hi everyone,

I am trying to display OSM data into my web map as well as other
custom layers.
One of the goals of my web application is to upload data from my
application to the osm database.  I have been reading this
http://wiki.openstreetmap.org/wiki/API_v0.6#Elements but still I
do not understand how a PUT request functions. I have so much to
learn

After authentificating with osmauth.js I try this code without
any success. I get a 401 error.

var xml_string = ' ';

ajaxurl= "http://www.openstreetmap.org/api/0.6/node/create;
;

$.ajax({
url: ajaxurl,
data: xml_string,
type: 'PUT',
contentType: "text/xml",
dataType: "text",
success : function (resp){console.debug(resp)},
error : function (xhr, ajaxOptions, thrownError){
console.log(xhr.status);
console.log(thrownError);
}
});

Do I need to include oauth_secret and oauth_consumer_key from
the authentification proccess in the ajax request?

Any help will be really apreciated.
Thanks
-- 
*Toni Hernández Vallès*

Servei de Sistemes d'Informació Geogràfica i Teledetecció
-
Universitat de Girona
*SIGTE*
-
Pl. Ferrater Mora 1
17071 Girona
Tel +34 972 418 039 (7026 intern)
t...@sigte.udg.edu 

http://www.sigte.udg.edu 
Twitter http://twitter.com/SIGTE_UDG

___
dev mailing list
dev@openstreetmap.org 
https://lists.openstreetmap.org/listinfo/dev


___
dev mailing list
dev@openstreetmap.org 
https://lists.openstreetmap.org/listinfo/dev



___
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev




___
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev


___
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev