N-Ways
Documentation développeursCodes

Codes

Codes postaux NIPOST, adresses GhanaPost GPS, Plus Codes et codes maison N-Ways, en une seule recherche.

Sur cette page
Remarque :

Envoyez votre clé avec key=VOTRE_CLE_API dans l’adresse, ou dans l’en-tête X-NWays-Api-Key. Clés d’API

Adresse de base : https://nways.ng/maps/v1

Tout code que les gens écrivent comme adresse

GET https://nways.ng/maps/v1/codes/{code}

Un code postal NIPOST (LA 08 A09 DB 09, sous n’importe quelle forme écrite), une adresse GhanaPost GPS (GA-183-8164), un Plus Code (6FR5J975+P4W, ou un code court avec near= ou une ville après lui : J975+P4 Ikeja) ou un code maison N-Ways (le nom d’un lieu et un numéro, Fréau-Jardin 10 58, dans chaque pays où N-Ways en émet), encodé pour l’URL. Le type est détecté (type= en impose un) ; la réponse donne le type, l’emplacement, une adresse sur une ligne et le détail propre au type (postcode, ghanaPost, plusCode ou homeCode). Un texte qui n’est aucun type de code répond CODE_UNRECOGNISED et n’est pas compté. Pour les codes maison, country= et near= départagent les pays où le même nom et le même numéro existent. Raisons : CODE_REQUIRED, CODE_UNRECOGNISED, TYPE_INVALID, NEAR_INVALID, COUNTRY_INVALID, LANG_INVALID, POSTCODE_INVALID, POSTCODE_NOT_FOUND_CHECK, POSTCODE_NOT_NIPOST, GHANAPOST_INVALID, GHANAPOST_UNKNOWN, PLUSCODE_INVALID, PLUSCODE_SHORT, LOCALITY_NOT_FOUND, HOMECODE_UNKNOWN, HOMECODE_FORMAT (type=homecode uniquement), HOMECODE_OUTSIDE.

Paramètres

NomOùTypeDescription
codecheminstringObligatoire. 120 caractères au plus.
typerequêtestringImpose un type (par défaut : détecté). Au choix: postcode, ghanapost, pluscode, homecode.
nearrequêtestringlat,lng : classer et choisir les résultats proches de ce point.
countryrequêtestringCodes maison : le pays où chercher.
langrequêtestringAu choix: en, fr, pt. Par défaut: en.
fieldsrequêtestringListe séparée par des virgules des champs à garder dans chaque résultat (a.b descend dans les objets ; id est toujours gardé ; * = tous).
cURL
curl "https://nways.ng/maps/v1/codes/LA%2008%20A09%20DB%2009" \
  -H "X-NWays-Api-Key: VOTRE_CLE_API"
JavaScript
const res = await fetch('https://nways.ng/maps/v1/codes/LA%2008%20A09%20DB%2009', {
  headers: { 'X-NWays-Api-Key': process.env.NWAYS_API_KEY },
})
const data = await res.json()
Python
import os
import requests

res = requests.get(
    "https://nways.ng/maps/v1/codes/LA%2008%20A09%20DB%2009",
    headers={"X-NWays-Api-Key": os.environ["NWAYS_API_KEY"]},
    timeout=10,
)
data = res.json()

Réponse

Le code

ChampTypeDescription
querystringObligatoire.
typestringObligatoire. Au choix: postcode, ghanapost, pluscode, homecode.
codestringObligatoire. Tel qu’il est écrit : LA 08 A09 DB 09, GA-183-8164, 6FR5J975+P4W, Fréau-Jardin 10 58.
locationPointObligatoire.
location.typestringObligatoire.
location.coordinatesnumber[]Obligatoire. [lng, lat] Au moins 2 éléments, au plus 2 éléments.
countrystring
formattedAddressstring
estimatedboolean
accuracyMnumber
postcodePostcode
postcode.codestringObligatoire.
postcode.displaystringObligatoire.
postcode.componentsPostcodeComponentsObligatoire.
postcode.components.statestringObligatoire.
postcode.components.stateNamestring
postcode.components.lgastringObligatoire.
postcode.components.lgaNamestring
postcode.components.districtstringObligatoire.
postcode.components.areastringObligatoire.
postcode.components.buildingstringObligatoire.
postcode.locationPointObligatoire.
postcode.location.typestringObligatoire.
postcode.location.coordinatesnumber[]Obligatoire. [lng, lat] Au moins 2 éléments, au plus 2 éléments.
postcode.namestring
postcode.addressstring
postcode.buildingTypestring
postcode.entrancesEntrance[]Obligatoire. Les vérifiées d’abord, la principale en premier : l’itinéraire mène à la première.
postcode.entrances[].locationPointObligatoire.
postcode.entrances[].location.typestringObligatoire.
postcode.entrances[].location.coordinatesnumber[]Obligatoire. [lng, lat] Au moins 2 éléments, au plus 2 éléments.
postcode.entrances[].kindstringObligatoire. Au choix: main, gate, pedestrian, service.
postcode.entrances[].verifiedbooleanObligatoire.
postcode.plusCodestringObligatoire.
postcode.countrystringObligatoire.
postcode.sourcestringObligatoire. Au choix: nipost, osm, user, estimate.
postcode.estimatedbooleanObligatoire.
postcode.accuracyMnumber
postcode.distanceMnumberGéocodage inverse : depuis le point demandé.
postcode.attributionstringObligatoire.
ghanaPostResult
ghanaPost.idstringObligatoire.
ghanaPost.namestringObligatoire.
ghanaPost.typestringObligatoire. address, street, business, landmark, building, postcode, ghanapost, ou une zone : neighbourhood, suburb, village, town, city, state…
ghanaPost.categorystring
ghanaPost.locationPointObligatoire.
ghanaPost.location.typestringObligatoire.
ghanaPost.location.coordinatesnumber[]Obligatoire. [lng, lat] Au moins 2 éléments, au plus 2 éléments.
ghanaPost.bboxnumber[]ouest, sud, est, nord (zones) Au moins 4 éléments, au plus 4 éléments.
ghanaPost.formattedAddressstring
ghanaPost.postcodestringCode postal NIPOST, forme compacte
ghanaPost.ghanaPoststring
ghanaPost.plusCodestringObligatoire.
ghanaPost.countrystring
ghanaPost.distanceMnumberDepuis near (ou le point demandé).
ghanaPost.estimatedbooleanLe point est une estimation, à accuracyM près.
ghanaPost.accuracyMnumber
ghanaPost.placeIdstringUn commerce : son id pour /places/{id}.
ghanaPost.attributionstring
plusCodePlusCodeResponse
plusCode.locationPointObligatoire.
plusCode.location.typestringObligatoire.
plusCode.location.coordinatesnumber[]Obligatoire. [lng, lat] Au moins 2 éléments, au plus 2 éléments.
plusCode.plusCodestringObligatoire.
plusCode.countryArea | nullObligatoire.
plusCode.regionArea | nullObligatoire.
plusCode.formattedAddressstring
plusCode.postcodePostcode | nullObligatoire. Nigeria : le code postal NIPOST du bâtiment, quand il y en a un à portée.
plusCode.ghanaPoststring | nullObligatoire. Ghana : l’adresse GhanaPost GPS connue la plus proche (à moins de 100 m).
plusCode.nearestResult | nullObligatoire.
plusCode.attributionstringObligatoire.
plusCode.boundsnumber[]Obligatoire. ouest, sud, est, nord Au moins 4 éléments, au plus 4 éléments.
homeCodeHomeCodeUn code maison N-Ways : l’adresse d’un bâtiment sous forme de nom et de numéro. Les gens écrivent code ; machine porte la clé de contrôle pour les systèmes.
homeCode.codestringObligatoire.
homeCode.machinestringObligatoire. Avec la clé de contrôle (systèmes uniquement ; jamais montrée aux personnes).
homeCode.countrystringObligatoire.
homeCode.namestringObligatoire.
homeCode.officialNamestring
homeCode.coveragestringLà où une adresse officielle existe (officialAddress d’abord). Au choix: official, official-pending.
homeCode.officialAddressstring
homeCode.nameProvisionalbooleanObligatoire.
homeCode.nearstring
homeCode.municipalitystringObligatoire.
homeCode.islandstring
homeCode.postcodestring
homeCode.fullLinestringObligatoire.
homeCode.spokenstringObligatoire.
homeCode.statusstringObligatoire.
homeCode.locationPointObligatoire.
homeCode.location.typestringObligatoire.
homeCode.location.coordinatesnumber[]Obligatoire. [lng, lat] Au moins 2 éléments, au plus 2 éléments.
homeCode.entranceobject
homeCode.entrance.locationPointObligatoire.
homeCode.entrance.location.typestringObligatoire.
homeCode.entrance.location.coordinatesnumber[]Obligatoire. [lng, lat] Au moins 2 éléments, au plus 2 éléments.
homeCode.entrance.kindstringObligatoire. portail, porte ou centre
homeCode.entrance.verifiedbooleanObligatoire. Placé par des personnes sur place.
homeCode.plusCodestringObligatoire.
homeCode.creditstringObligatoire.
homeCode.creditUrlstring (uri)Obligatoire.
attributionstringObligatoire.
200 OK
{
  "query": "string",
  "type": "postcode",
  "code": "string",
  "location": {
    "type": "string",
    "coordinates": [
      0
    ]
  },
  "country": "string",
  "formattedAddress": "string",
  "estimated": true,
  "accuracyM": 0,
  "postcode": {
    "code": "LA08A09DB09",
    "display": "LA 08 A09 DB 09",
    "components": {
      "state": "LA",
      "stateName": "Lagos",
      "lga": "08",
      "lgaName": "Eti-Osa",
      "district": "A09",
      "area": "DB",
      "building": "09"
    },
    "location": {
      "type": "string",
      "coordinates": [
        0
      ]
    },
    "name": "string",
    "address": "string",
    "buildingType": "string",
    "entrances": [
      {
        "location": {
          "type": "string",
          "coordinates": []
        },
        "kind": "main",
        "verified": true
      }
    ],
    "plusCode": "string",
    "country": "string",
    "source": "nipost",
    "estimated": true,
    "accuracyM": 0,
    "distanceM": 0,
    "attribution": "string"
  },
  "ghanaPost": {
    "id": "osm:w568367632",
    "name": "Ikeja City Mall",
    "type": "landmark",
    "category": "shopping",
    "location": {
      "type": "string",
      "coordinates": [
        0
      ]
    },
    "bbox": [
      0
    ],
    "formattedAddress": "Ikeja, Lagos",
    "postcode": "LA08A09DB09",
    "ghanaPost": "GA-183-8164",
    "plusCode": "6FR5J975+P4W",
    "country": "NG",
    "distanceM": 0,
    "estimated": true,
    "accuracyM": 0,
    "placeId": "string",
    "attribution": "string"
  },
  "plusCode": {
    "location": {
      "type": "string",
      "coordinates": [
        0
      ]
    },
    "plusCode": "string",
    "country": {
      "code": "NG-LA",
      "name": "Lagos State",
      "nameFr": "string",
      "namePt": "string"
    },
    "region": {
      "code": "NG-LA",
      "name": "Lagos State",
      "nameFr": "string",
      "namePt": "string"
    },
    "formattedAddress": "12 Admiralty Way, Lekki, Lagos State, Nigeria",
    "postcode": {
      "code": "LA08A09DB09",
      "display": "LA 08 A09 DB 09",
      "components": {
        "state": "LA",
        "stateName": "Lagos",
        "lga": "08",
        "lgaName": "Eti-Osa",
        "district": "A09",
        "area": "DB",
        "building": "09"
      },
      "location": {
        "type": "string",
        "coordinates": [
          0
        ]
      },
      "name": "string",
      "address": "string",
      "buildingType": "string",
      "entrances": [
        {
          "location": {},
          "kind": "main",
          "verified": true
        }
      ],
      "plusCode": "string",
      "country": "string",
      "source": "nipost",
      "estimated": true,
      "accuracyM": 0,
      "distanceM": 0,
      "attribution": "string"
    },
    "ghanaPost": "string",
    "nearest": {
      "id": "osm:w568367632",
      "name": "Ikeja City Mall",
      "type": "landmark",
      "category": "shopping",
      "location": {
        "type": "string",
        "coordinates": [
          0
        ]
      },
      "bbox": [
        0
      ],
      "formattedAddress": "Ikeja, Lagos",
      "postcode": "LA08A09DB09",
      "ghanaPost": "GA-183-8164",
      "plusCode": "6FR5J975+P4W",
      "country": "NG",
      "distanceM": 0,
      "estimated": true,
      "accuracyM": 0,
      "placeId": "string",
      "attribution": "string"
    },
    "attribution": "string",
    "bounds": [
      0
    ]
  },
  "homeCode": {
    "code": "Fréau-Jardin 10 58",
    "machine": "string",
    "country": "CV",
    "name": "string",
    "officialName": "string",
    "coverage": "official",
    "officialAddress": "string",
    "nameProvisional": true,
    "near": "string",
    "municipality": "string",
    "island": "string",
    "postcode": "string",
    "fullLine": "string",
    "spoken": "string",
    "status": "string",
    "location": {
      "type": "string",
      "coordinates": [
        0
      ]
    },
    "entrance": {
      "location": {
        "type": "string",
        "coordinates": [
          0
        ]
      },
      "kind": "string",
      "verified": true
    },
    "plusCode": "string",
    "credit": "Home code by N-Ways Addressing",
    "creditUrl": "string"
  },
  "attribution": "string"
}

Erreurs

  • default Erreur

Jusqu’à 100 codes de tout type à la fois

POST https://nways.ng/maps/v1/codes/batch

Chaque code est une unité du SKU codes. Une réponse par code, dans l’ordre (result, comme /codes/{code}), avec sa propre erreur s’il en a une. type, near, country et lang s’appliquent à chaque code. Raisons (pour tout l’appel) : CODES_INVALID, TYPE_INVALID, NEAR_INVALID, COUNTRY_INVALID, LANG_INVALID.

Corps de la requête

ChampTypeDescription
codesstring[]Obligatoire. Au moins 1 éléments, au plus 100 éléments.
typestringAu choix: postcode, ghanapost, pluscode, homecode.
nearLatLng
near.latnumberObligatoire. ≥ -90, ≤ 90.
near.lngnumberObligatoire. ≥ -180, ≤ 180.
countrystring
langstringAu choix: en, fr, pt.
cURL
curl -X POST "https://nways.ng/maps/v1/codes/batch" \
  -H "X-NWays-Api-Key: VOTRE_CLE_API" \
  -H "Content-Type: application/json" \
  -d '{"codes":["LA08A09DB09","GA-183-8164","6FR5J975+P4W","Fréau-Jardin 10 58"]}'
JavaScript
const res = await fetch('https://nways.ng/maps/v1/codes/batch', {
  method: 'POST',
  headers: { 'X-NWays-Api-Key': process.env.NWAYS_API_KEY, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "codes": [
      "LA08A09DB09",
      "GA-183-8164",
      "6FR5J975+P4W",
      "Fréau-Jardin 10 58"
    ]
  }),
})
const data = await res.json()
Python
import os
import requests

res = requests.post(
    "https://nways.ng/maps/v1/codes/batch",
    headers={"X-NWays-Api-Key": os.environ["NWAYS_API_KEY"]},
    json={"codes": ["LA08A09DB09", "GA-183-8164", "6FR5J975+P4W", "Fréau-Jardin 10 58"]},
    timeout=10,
)
data = res.json()

Réponse

Un résultat par code

ChampTypeDescription
resultsobject[]Obligatoire.
results[].querystringObligatoire.
results[].resultCodeResponse
results[].result.querystringObligatoire.
results[].result.typestringObligatoire. Au choix: postcode, ghanapost, pluscode, homecode.
results[].result.codestringObligatoire. Tel qu’il est écrit : LA 08 A09 DB 09, GA-183-8164, 6FR5J975+P4W, Fréau-Jardin 10 58.
results[].result.locationPointObligatoire.
results[].result.location.typestringObligatoire.
results[].result.location.coordinatesnumber[]Obligatoire. [lng, lat] Au moins 2 éléments, au plus 2 éléments.
results[].result.countrystring
results[].result.formattedAddressstring
results[].result.estimatedboolean
results[].result.accuracyMnumber
results[].result.postcodePostcode
results[].result.postcode.codestringObligatoire.
results[].result.postcode.displaystringObligatoire.
results[].result.postcode.componentsPostcodeComponentsObligatoire.
results[].result.postcode.locationPointObligatoire.
results[].result.postcode.namestring
results[].result.postcode.addressstring
results[].result.postcode.buildingTypestring
results[].result.postcode.entrancesEntrance[]Obligatoire. Les vérifiées d’abord, la principale en premier : l’itinéraire mène à la première.
results[].result.postcode.plusCodestringObligatoire.
results[].result.postcode.countrystringObligatoire.
results[].result.postcode.sourcestringObligatoire. Au choix: nipost, osm, user, estimate.
results[].result.postcode.estimatedbooleanObligatoire.
results[].result.postcode.accuracyMnumber
results[].result.postcode.distanceMnumberGéocodage inverse : depuis le point demandé.
results[].result.postcode.attributionstringObligatoire.
results[].result.ghanaPostResult
results[].result.ghanaPost.idstringObligatoire.
results[].result.ghanaPost.namestringObligatoire.
results[].result.ghanaPost.typestringObligatoire. address, street, business, landmark, building, postcode, ghanapost, ou une zone : neighbourhood, suburb, village, town, city, state…
results[].result.ghanaPost.categorystring
results[].result.ghanaPost.locationPointObligatoire.
results[].result.ghanaPost.bboxnumber[]ouest, sud, est, nord (zones) Au moins 4 éléments, au plus 4 éléments.
results[].result.ghanaPost.formattedAddressstring
results[].result.ghanaPost.postcodestringCode postal NIPOST, forme compacte
results[].result.ghanaPost.ghanaPoststring
results[].result.ghanaPost.plusCodestringObligatoire.
results[].result.ghanaPost.countrystring
results[].result.ghanaPost.distanceMnumberDepuis near (ou le point demandé).
results[].result.ghanaPost.estimatedbooleanLe point est une estimation, à accuracyM près.
results[].result.ghanaPost.accuracyMnumber
results[].result.ghanaPost.placeIdstringUn commerce : son id pour /places/{id}.
results[].result.ghanaPost.attributionstring
results[].result.plusCodePlusCodeResponse
results[].result.plusCode.locationPointObligatoire.
results[].result.plusCode.plusCodestringObligatoire.
results[].result.plusCode.countryArea | nullObligatoire.
results[].result.plusCode.regionArea | nullObligatoire.
results[].result.plusCode.formattedAddressstring
results[].result.plusCode.postcodePostcode | nullObligatoire. Nigeria : le code postal NIPOST du bâtiment, quand il y en a un à portée.
results[].result.plusCode.ghanaPoststring | nullObligatoire. Ghana : l’adresse GhanaPost GPS connue la plus proche (à moins de 100 m).
results[].result.plusCode.nearestResult | nullObligatoire.
results[].result.plusCode.attributionstringObligatoire.
results[].result.plusCode.boundsnumber[]Obligatoire. ouest, sud, est, nord Au moins 4 éléments, au plus 4 éléments.
results[].result.homeCodeHomeCodeUn code maison N-Ways : l’adresse d’un bâtiment sous forme de nom et de numéro. Les gens écrivent code ; machine porte la clé de contrôle pour les systèmes.
results[].result.homeCode.codestringObligatoire.
results[].result.homeCode.machinestringObligatoire. Avec la clé de contrôle (systèmes uniquement ; jamais montrée aux personnes).
results[].result.homeCode.countrystringObligatoire.
results[].result.homeCode.namestringObligatoire.
results[].result.homeCode.officialNamestring
results[].result.homeCode.coveragestringLà où une adresse officielle existe (officialAddress d’abord). Au choix: official, official-pending.
results[].result.homeCode.officialAddressstring
results[].result.homeCode.nameProvisionalbooleanObligatoire.
results[].result.homeCode.nearstring
results[].result.homeCode.municipalitystringObligatoire.
results[].result.homeCode.islandstring
results[].result.homeCode.postcodestring
results[].result.homeCode.fullLinestringObligatoire.
results[].result.homeCode.spokenstringObligatoire.
results[].result.homeCode.statusstringObligatoire.
results[].result.homeCode.locationPointObligatoire.
results[].result.homeCode.entranceobject
results[].result.homeCode.plusCodestringObligatoire.
results[].result.homeCode.creditstringObligatoire.
results[].result.homeCode.creditUrlstring (uri)Obligatoire.
results[].result.attributionstringObligatoire.
results[].errorItemError
results[].error.codeintegerObligatoire.
results[].error.reasonstringObligatoire.
results[].error.messagestringObligatoire.
attributionstringObligatoire.
200 OK
{
  "results": [
    {
      "query": "string",
      "result": {
        "query": "string",
        "type": "postcode",
        "code": "string",
        "location": {
          "type": "string",
          "coordinates": []
        },
        "country": "string",
        "formattedAddress": "string",
        "estimated": true,
        "accuracyM": 0,
        "postcode": {
          "code": "LA08A09DB09",
          "display": "LA 08 A09 DB 09",
          "components": {},
          "location": {},
          "name": "string",
          "address": "string",
          "buildingType": "string",
          "entrances": [],
          "plusCode": "string",
          "country": "string",
          "source": "nipost",
          "estimated": true,
          "accuracyM": 0,
          "distanceM": 0,
          "attribution": "string"
        },
        "ghanaPost": {
          "id": "osm:w568367632",
          "name": "Ikeja City Mall",
          "type": "landmark",
          "category": "shopping",
          "location": {},
          "bbox": [],
          "formattedAddress": "Ikeja, Lagos",
          "postcode": "LA08A09DB09",
          "ghanaPost": "GA-183-8164",
          "plusCode": "6FR5J975+P4W",
          "country": "NG",
          "distanceM": 0,
          "estimated": true,
          "accuracyM": 0,
          "placeId": "string",
          "attribution": "string"
        },
        "plusCode": {
          "location": {},
          "plusCode": "string",
          "country": {},
          "region": {},
          "formattedAddress": "12 Admiralty Way, Lekki, Lagos State, Nigeria",
          "postcode": {},
          "ghanaPost": "string",
          "nearest": {},
          "attribution": "string",
          "bounds": []
        },
        "homeCode": {
          "code": "Fréau-Jardin 10 58",
          "machine": "string",
          "country": "CV",
          "name": "string",
          "officialName": "string",
          "coverage": "official",
          "officialAddress": "string",
          "nameProvisional": true,
          "near": "string",
          "municipality": "string",
          "island": "string",
          "postcode": "string",
          "fullLine": "string",
          "spoken": "string",
          "status": "string",
          "location": {},
          "entrance": {},
          "plusCode": "string",
          "credit": "Home code by N-Ways Addressing",
          "creditUrl": "string"
        },
        "attribution": "string"
      },
      "error": {
        "code": 0,
        "reason": "string",
        "message": "string"
      }
    }
  ],
  "attribution": "string"
}

Erreurs

  • default Erreur