OCM API ¦ Failed to retrieve data, status code: 403

Hello, @ Christopher
Please, i’m trying to connect to the OCM API with a simple python code to access the API and store the data directly as a local JSON file. [status code: 403]
the error indicate that the request was understood by the server but it refuses to authorize it.
Is the API endpoint restricted to a specific IP addresses, or requires authentication ?
my ideal need is to have an up to date dataset of the EV charging stations and store them in a spatial database to process them, analyze them and join them with other factors.
Thanks in advance.

Hi, the API documentation is here: https://openchargemap.org/site/develop/api#/

You need an API key, which you can get from openchargemap.org, sign in and select my apps from the my profile menu.

Some http user agent headers may be blocked so we recommend setting the user agent to a custom value to identify your app.

1 Like

@Christopher Thank you, it works well.
for the moment I tried to extract the data for Morocco as I realized that the data is not very complete, the data with Moroccan country ID does not contain the data of the whole country, the western side is missing. Regardless of the political considerations in this region, I am aware that many charging stations exist in these regions, but they do not appear on your map.

Globally about half of the data we have is imported from public sources, the other half of the data is entered manually by users.

In many cases we will have enthusiastic users contributing data in certain regions, but not in others. All I can suggest is either helping us find a good open data source for the region (some governments provide data sets that we are allowed to use) or encouraging people to enter data themselves.

However, I am reluctant to import data generally because quality can be low and we/I have to develop custom import methods for every different data source, unless the data is in a standard format. If the data sets are small the effort is not worthwhile and users are better to simply supply the information themselves especially as we then benefit from their local knowledge.

Regarding the points you expect to see on the western side of the country, the following is a screenshot of data from Plugshare (which is a different dataset to OCM):

And here is a screenshot of OCM for the same area:

Are you expecting to see something different, if so is there a map online somewhere that shows different results?

I apologize for any confusion. What I meant to say was the South of Morocco, specifically the Western Sahara region. I have verified the PlugShare map, and while it does show a few charging stations in the area, it is not complete. As an alternative, there is a private Moroccan website (https://www.voitureelectrique.ma/borne-de-recharge/) that contains more complete data. I have contacted them to see if there is a way to share their information. Unfortunately, there is currently no public organization that provides EV data.

Thanks, it looks like there are only 4 missing in Western Sahara, you can add these yourself. To do so using https://map.openchargemap.io/ choose Add Location from the app menu, zoom in and position the map centre marker on the charge location then provide approximate address details and equipment details (at least the connection type and power kW).

1 Like

Thank you, I’ll add the missing stations manually.

1 Like