ORIGIN_PLACE_NOT_FOUND and DESTINATION_PLACE_NOT_FOUND

Hi,

Can you please tell me what the intention of these two error codes are:

ORIGIN_PLACE_NOT_FOUND
DESTINATION_PLACE_NOT_FOUND

Do they mean that the driver went to look for the address but physically could not find them, or something more like the address given to the system could not be found in the database, etc? Is this an error we would expect to see upon creating a job, or something that could happen once the driver is already in progress?

Thank you,
Mike

Hi Mike,

These are errors you can expect to see as response of Job creation when the pickup address or dropoff address you provide cannot be geocoded. This will prevent the job creation as addresses are required parameters.

To avoid these addresses errors we recommend you to use Google autocomplete API for addresses (format will be 100% valid as we use Google Geocoding).

Kind Regards,

Also, are all of the error codes available in the system listed in the docs (https://stuart.api-docs.io/v2/general-topics/errors)?

I am wondering because it seems there are some differences between v1 and v2?

For example, in our earlier code, we are handling:

JOB_DESTINATION_CONTACT_PHONE_INVALID
PLACE_CONTACT_PHONE_INVALID
PLACE_CONTACT_PHONE_MISSING

But I don’t see these in the list of errors in the docs. There are other also, and I wonder where they might be found?

In v1 API, they were coded for error 422000, and I can’t find those in the v1 or v2 docs either.

Thanks for your help!
Mike

Many thanks @Lauren! Can you please point me a list of other error codes we can expect to encounter during job creation or updating?

No problem,

The documented error list is the one you mentioned: https://stuart.api-docs.io/v2/general-topics/errors
Some errors might be missing, we will have a look at this but in the meantime if you encounter one that is not listed you should fall back to the HTTP status code to handle it correctly.

The 3 errors about the contact phone you mentioned are indeed 422000 errors that are documented in the Responses section of the Create a Job endpoint.

1 Like

Hi @Lauren, can you please confirm that these are address related errors that we can expect to encounter on job creation, and not error codes that we would see while the job is being processed and delivered by the courier:

ADDRESS_NOT_FOUND
CITY_NOT_FOUND
CANT_GEOCODE_ADDRESS
ORIGIN_PLACE_NOT_FOUND
DESTINATION_PLACE_NOT_FOUND
PLACE_NOT_FOUND
PLACE_ADDRESS_NOT_SPECIFIC
CITY_CREATE_ERROR
DELIVERY_NOT_FOUND

Hi Mike,

The best way for handling errors is to share with me the list of business rules you have so I can redirect you to the correct process and error messages.

1 Like

Hi @Lauren,

What we would love to do is to handle 422 errors and based on what the error is, possibly make adjustments to whatever needs it and retry the create job until it either is accepted or we’ve run out of options to correct something.

One thing we were handling in v1 was the error “JOB_DELIVERIES_INVALID” and are checking on our side if the job had already been created. For v2, I imagine that status for that is “DUPLICATE_JOB”, is that right?

We were also handling “PLACE_ADDRESS_INVALID” and “JOB_DESTINATION_ADDRESS_INVALID”

Also, “JOB_DESTINATION_CONTACT_PHONE_INVALID” “PLACE_CONTACT_PHONE_INVALID” “PLACE_CONTACT_PHONE_MISSING”

So if we can know the error codes to watch for to handle addresses and phones, that’d be awesome.

Can you please let me know?

Thank you :slight_smile:
Mike

Hi @MichaelGurevich

In V2 when you create a Job with a client_reference we will check if there is another running job with it.
If you try to create a Job that has already been created with the same client_reference we will prevent the job creation and send the following 422 error :

{
    "error": "RECORD_INVALID",
    "message": "Unable to save record",
    "data": {
        "deliveries": [
            "is invalid",
            "Client reference: \"your_client_reference\" has already been taken"
        ]
    }
}

Addresses errors

The “PLACE_ADDRESS_INVALID” and “JOB_DESTINATION_ADDRESS_INVALID” will be one of the following errors:

{
    "error": "CANT_GEOCODE_ADDRESS",
    "message": "The address can't be geocoded"
}

If the address is not in the Stuart delivery zone coverage:

{
    "error": "OUT_OF_RANGE",
    "message": "This location is out of range."
}

If the delivery exceeds the maximum distance allowed:

{
    "error": "JOB_DISTANCE_NOT_ALLOWED",
    "message": "Price calculation for bike in Paris with distance 57.648 km is out of bounds."
}

Contact phone

When the pickup or dropoff address is not precise enough we will required the corresponding contact phone

{
    "error": "ADDRESS_CONTACT_PHONE_REQUIRED",
    "message": "Contact phone is required."
}

If the phone number is invalid:

{
    "error": "RECORD_INVALID",
    "message": "Unable to save record",
    "data": {
        "deliveries": [
            "is invalid",
            "Origin place: can't be blank",
            "Origin place: Contact phone: \"+3361010101010\" is an invalid number"
        ]
    }
}

Best Regards,

1 Like

Thank you very much @Lauren :slight_smile: