Search code examples
apigpswaze

Add automatically Point of interest


I'm currently working on a project and I want to automatically add information about a company or professional person. I know that there is a Waze API (hosted by Google) but they don't provide the possibility to add or modify map information. There is a "UI way" to modify map information with map editor. If someone has a tricky solution...I'll take it!


Solution

  • It's possible, but not quite easy.

    You can mimic the calls made by your web browser in order to add places within the Waze Map Editor (use the network monitor of your browser to see what requests are sent out). Basically, you'd need to load the index page to retrieve a session token cookie, start a session with that token and your login credentials and then send the data you're sending when you save your edit in the editor (it's in this request that you'll adjust which place you want to add and where you want to add it). The main thing you'll need to watch out for is that with each request, the cookies get updated with a new CSRF token.

    After logging in, the following URL can receive an HTTP POST request: https://www.waze.com/row-Descartes/app/Features?language=en with, for example, the following data:

    {
      'actions': {
        'name': 'CompositeAction',
        '_subActions': [
          {
            'name': 'AddLandmark',
            '_subActions': [
              {
                '_objectType': 'venue',
                'action': 'ADD',
                'attributes': {
                  'geometry': {
                    'type': 'Point',
                    'coordinates': [
                      ??.????,
                      ??.????
                    ]
                  },
                  'categories': [
                    'OTHER'
                  ],
                  'name': '',
                  'description': '',
                  'rank': 0,
                  'lockRank': 0,
                  'url': null,
                  'phone': null,
                  'brand': null,
                  'residential': false,
                  'openingHours': [
                  ],
                  'categoryAttributes': {
                  },
                  'services': [
                  ],
                  'entryExitPoints': [
                  ],
                  'images': [
                  ],
                  'venueUpdateRequests': [
                  ],
                  'aliases': [
                  ],
                  'approved': true,
                  'externalProviderIDs': [
                  ],
                  'adLocked': false,
                  'permissions': 2147483647,
                  'streetID': ????,
                  'id': - 100
                }
              }
            ]
          },
          {
            '_objectType': 'venue',
            'action': 'UPDATE',
            'attributes': {
              'name': 'Test',
              'id': - 100
            }
          },
          {
            '_objectType': 'venue',
            'action': 'UPDATE',
            'attributes': {
              'description': 'To remove',
              'id': - 100
            }
          }
        ]
      }
    }
    

    As you can see, you'll need to fill in the coordinates (which I assume you'll have) and the various other fields. It would also be best that you can specify the exact address where this place is located, but that would require you to retrieve the ID of the street nearby. If you don't want to go into that trouble, you can also just leave out the streetID field. I've tested it and that works just fine.

    Also, within the WME this change is split up in several separate actions (a 'composite' action). You can just put all data within the first action and remove the two update actions.

    I've made something similar in Java a while ago to listen in on the chat within the Waze Map Editor. The logging in part goes flawlessly there, so it's possible to pull off.

    Update 2018-03-14: As for an official way of adding/editing places in Waze, if you can get recognized as a connected citizens partner: it is possible to provide a feed to Waze with a list of venues. More information can be found at Waze Partners Help > Connected Citizens > Parking, gas, snow plows and other feeds