Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined array to search stop location #2

Open
reyadkhan opened this issue Mar 7, 2023 · 0 comments
Open

Undefined array to search stop location #2

reyadkhan opened this issue Mar 7, 2023 · 0 comments

Comments

@reyadkhan
Copy link
Contributor

reyadkhan commented Mar 7, 2023

ERROR: Undefined array key "StopLocation" {"exception":"[object] (ErrorException(code: 0): Undefined array key "StopLocation" at resrobot-php-sdk\src\Trafiklab\ResRobot\Model\ResRobotStopLocationLookupResponse.php:59)

When the response returns CoordLocation instead of only StopLocation then this issue will occur.
Example request: https://api.resrobot.se/v2.1/location.name?input=hom&format=json&accessId={access_id}
Response:

{
    "stopLocationOrCoordLocation": [
        {
            "StopLocation": {
                "productAtStop": [
                    {
                        "icon": {
                            "res": "prod_gen"
                        },
                        "cls": "128"
                    }
                ],
                "timezoneOffset": 60,
                "id": "A=1@O=Homna (Ovanåker kn)@X=15620861@Y=61346596@U=1@L=740018783@B=1@p=1678164153@",
                "extId": "740018783",
                "name": "Homna (Ovanåker kn)",
                "lon": 15.620861,
                "lat": 61.346596,
                "weight": 22,
                "products": 128
            }
        },
        {
            "StopLocation": {
                "productAtStop": [
                    {
                        "icon": {
                            "res": "prod_gen"
                        },
                        "cls": "128"
                    }
                ],
                "timezoneOffset": 60,
                "id": "A=1@O=Homons ÅVC (Nordanstig kn)@X=17183941@Y=61976668@U=1@L=740044625@B=1@p=1678164153@",
                "extId": "740044625",
                "name": "Homons ÅVC (Nordanstig kn)",
                "lon": 17.183941,
                "lat": 61.976668,
                "weight": 22,
                "products": 128
            }
        },
        {
            "StopLocation": {
                "productAtStop": [
                    {
                        "icon": {
                            "res": "prod_gen"
                        },
                        "cls": "128"
                    }
                ],
                "timezoneOffset": 60,
                "id": "A=1@O=Homrom vägskäl (Uppsala kn)@X=17140793@Y=59891269@U=1@L=740009296@B=1@p=1678164153@",
                "extId": "740009296",
                "name": "Homrom vägskäl (Uppsala kn)",
                "lon": 17.140793,
                "lat": 59.891269,
                "weight": 22,
                "products": 128
            }
        },
        {
            "StopLocation": {
                "productAtStop": [
                    {
                        "icon": {
                            "res": "prod_gen"
                        },
                        "cls": "128"
                    }
                ],
                "timezoneOffset": 60,
                "id": "A=1@O=Stora Homa (Gotland kn)@X=18202869@Y=57553184@U=1@L=740071014@B=1@p=1678164153@",
                "extId": "740071014",
                "name": "Stora Homa (Gotland kn)",
                "lon": 18.202869,
                "lat": 57.553184,
                "weight": 105,
                "products": 128
            }
        },
        {
            "StopLocation": {
                "productAtStop": [
                    {
                        "icon": {
                            "res": "prod_gen"
                        },
                        "cls": "128"
                    }
                ],
                "timezoneOffset": 60,
                "id": "A=1@O=Gammel-Homna (Ovanåker kn)@X=15674023@Y=61347423@U=1@L=740071309@B=1@p=1678164153@",
                "extId": "740071309",
                "name": "Gammel-Homna (Ovanåker kn)",
                "lon": 15.674023,
                "lat": 61.347423,
                "weight": 22,
                "products": 128
            }
        },
        {
            "StopLocation": {
                "productAtStop": [
                    {
                        "icon": {
                            "res": "prod_gen"
                        },
                        "cls": "128"
                    }
                ],
                "timezoneOffset": 60,
                "id": "A=1@O=Östra Homna (Ovanåker kn)@X=15640278@Y=61346623@U=1@L=740018787@B=1@p=1678164153@",
                "extId": "740018787",
                "name": "Östra Homna (Ovanåker kn)",
                "lon": 15.640278,
                "lat": 61.346623,
                "weight": 22,
                "products": 128
            }
        },
        {
            "CoordLocation": {
                "links": [
                    {
                        "link": [
                            {
                                "rel": "refine",
                                "href": "https://api.resrobot.se/v2.1/location.name?input=Homh%C3%A4llev%C3%A4gen%2C+Oskarshamn&refineId=A%3D2%40O%3DHomh%C3%A4llev%C3%A4gen%2C+Oskarshamn%40X%3D16472508%40Y%3D57273413%40U%3D174%40b%3D980050377%40B%3D1%40p%3D1479298166%40&type=A"
                            }
                        ]
                    }
                ],
                "icon": {
                    "res": "loc_addr"
                },
                "id": "A=2@O=Homhällevägen, Oskarshamn@X=16472508@Y=57273413@U=174@b=980050377@B=1@p=1479298166@",
                "name": "Homhällevägen, Oskarshamn",
                "type": "ADR",
                "lon": 16.472508,
                "lat": 57.273413,
                "refinable": true
            }
        },
        {
            "CoordLocation": {
                "links": [
                    {
                        "link": [
                            {
                                "rel": "refine",
                                "href": "https://api.resrobot.se/v2.1/location.name?input=Hommebodv%C3%A4gen%2C+Kivik&refineId=A%3D2%40O%3DHommebodv%C3%A4gen%2C+Kivik%40X%3D14228630%40Y%3D55686197%40U%3D174%40b%3D980050378%40B%3D1%40p%3D1479298166%40&type=A"
                            }
                        ]
                    }
                ],
                "icon": {
                    "res": "loc_addr"
                },
                "id": "A=2@O=Hommebodvägen, Kivik@X=14228630@Y=55686197@U=174@b=980050378@B=1@p=1479298166@",
                "name": "Hommebodvägen, Kivik",
                "type": "ADR",
                "lon": 14.22863,
                "lat": 55.686197,
                "refinable": true
            }
        },
        {
            "CoordLocation": {
                "links": [
                    {
                        "link": [
                            {
                                "rel": "refine",
                                "href": "https://api.resrobot.se/v2.1/location.name?input=Hommerbergs+gr%C3%A4nd%2C+Torekov&refineId=A%3D2%40O%3DHommerbergs+gr%C3%A4nd%2C+Torekov%40X%3D12624424%40Y%3D56423851%40U%3D174%40b%3D980050379%40B%3D1%40p%3D1479298166%40&type=A"
                            }
                        ]
                    }
                ],
                "icon": {
                    "res": "loc_addr"
                },
                "id": "A=2@O=Hommerbergs gränd, Torekov@X=12624424@Y=56423851@U=174@b=980050379@B=1@p=1479298166@",
                "name": "Hommerbergs gränd, Torekov",
                "type": "ADR",
                "lon": 12.624424,
                "lat": 56.423851,
                "refinable": true
            }
        },
        {
            "CoordLocation": {
                "links": [
                    {
                        "link": [
                            {
                                "rel": "refine",
                                "href": "https://api.resrobot.se/v2.1/location.name?input=Hommev%C3%A4gen%2C+K%C3%A5seberga&refineId=A%3D2%40O%3DHommev%C3%A4gen%2C+K%C3%A5seberga%40X%3D14065421%40Y%3D55387224%40U%3D174%40b%3D980050380%40B%3D1%40p%3D1479298166%40&type=A"
                            }
                        ]
                    }
                ],
                "icon": {
                    "res": "loc_addr"
                },
                "id": "A=2@O=Hommevägen, Kåseberga@X=14065421@Y=55387224@U=174@b=980050380@B=1@p=1479298166@",
                "name": "Hommevägen, Kåseberga",
                "type": "ADR",
                "lon": 14.065421,
                "lat": 55.387224,
                "refinable": true
            }
        }
    ],
    "TechnicalMessages": {
        "TechnicalMessage": [
            {
                "value": "2023-03-07 12:50:28",
                "key": "requestTime"
            }
        ]
    },
    "serverVersion": "2.25.0",
    "dialectVersion": "2.25",
    "requestId": "mdw4bni8g2wcy2wg"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant