Address Service - rettersoft/rbs-docs GitHub Wiki

RBS Address Service

This service provides queries and mutations for address-related data.

Models

AddressInput has following attributes.

{
    addressId?: string // If you prefer auto-generated ID, please do not send addressId to create a new address
    name: string
    userId?: string // This attribute is for admin access only.
    nameSurname?: string
    identityNo?: string
    recipient?: string
    phone?: string
    note?: string
    country?: string
    city?: string
    district?: string
    neighborhood?: string
    street?: string
    building?: string
    floor?: string
    door?: string
    postalCode?: string
    lat?: number
    lng?: number
    acc?: number
    invoiceType?: string // C: Corporate, I: Individual
    companyName?: string
    taxNo?: string
    taxOffice?: string
    isInvoice?: boolean
}

Get Address Information

rbs.address.request.GET_COUNTRIES : returns all countries

Example Response : { "areaId": "TR", "name": "TÜRKİYE" }


rbs.address.request.GET_CITIES : returns cities by country

country: CountryId

Example Request : { "country": "TR" }

Example Response : [{"areaId":"TR_ISTANBUL","name":"İSTANBUL","parentId":"TR","country":"TÜRKİYE"}]


rbs.address.request.GET_DISTRICTS : returns districts by city

city: CityId

Example Request : { "city": "TR_ISTANBUL" }

Example Response : [{"areaId":"TR_ISTANBUL_ADALAR","name":"ADALAR","parentId":"TR_ISTANBUL","country":"TÜRKİYE","city":"İSTANBUL"}]


rbs.address.request.GET_NEIGHBORHOODS : returns neighborhoods by district

district: DistrictId

Example: { "district": "TR_ISTANBUL_ATASEHIR" }

Example Response : [{"areaId":"TR_ISTANBUL_ATASEHIR_ASIKVEYSEL-MAH","name":"AŞIKVEYSEL MAH","parentId":"TR_ISTANBUL_ATASEHIR","country":"TÜRKİYE","city":"İSTANBUL","district":"ATAŞEHİR"}]


rbs.address.request.RESOLVE : returns reverse geocoding results from Google API

{ "lat": LATITUDE, "lng": LONGITUDE }

Example: { "lat": 41, "lng": 29 }

Example Response :

[
    {
        "address_components": [
            { "long_name": "277", "short_name": "277", "types": ["street_number"] },
            { "long_name": "Bedford Avenue", "short_name": "Bedford Ave", "types": ["route"] },
            {
                "long_name": "Williamsburg",
                "short_name": "Williamsburg",
                "types": ["neighborhood", "political"]
            },
            {
                "long_name": "Brooklyn",
                "short_name": "Brooklyn",
                "types": ["political", "sublocality", "sublocality_level_1"]
            },
            {
                "long_name": "Kings County",
                "short_name": "Kings County",
                "types": ["administrative_area_level_2", "political"]
            },
            {
                "long_name": "New York",
                "short_name": "NY",
                "types": ["administrative_area_level_1", "political"]
            },
            { "long_name": "United States", "short_name": "US", "types": ["country", "political"] },
            { "long_name": "11211", "short_name": "11211", "types": ["postal_code"] }
        ],
        "formatted_address": "277 Bedford Ave, Brooklyn, NY 11211, USA",
        "geometry": {
            "location": { "lat": 40.7142205, "lng": -73.9612903 },
            "location_type": "ROOFTOP",
            "viewport": {
                "south": 40.7128715197085,
                "west": -73.9626392802915,
                "north": 40.71556948029149,
                "east": -73.95994131970849
            }
        },
        "place_id": "ChIJd8BlQ2BZwokRAFUEcm_qrcA",
        "plus_code": { "compound_code": "P27Q+MF Brooklyn, NY, USA", "global_code": "87G8P27Q+MF" },
        "types": ["street_address"]
    }
]

Working With Users' Addresses

rbs.address.request.UPSERT_ADDRESS : inserts a new address or updates an existing address

Example Response : { "addressId": "ADDRESS_ID", "created": true }


rbs.address.request.LIST_ADDRESSES : returns list of user's addresses

Example Response : [{"userId":"905305553322","addressId":"01ERVD8Z3A827Z1MGMSEQH0R6Z","name":"Test","country":"Türkiye","city":"İzmir"}]


rbs.address.request.GET_ADDRESS : returns an address of a user

addressId: ADDRESS_ID

Example Response : {"userId":"905305553322","addressId":"01ERVD8Z3A827Z1MGMSEQH0R6Z","name":"Test","country":"Türkiye","city":"İzmir"}


rbs.address.request.REMOVE_ADDRESS : removes an existing address from an existing user

addressId: ADDRESS_ID

Example Response : { "addressId": "ADDRESS_ID" }