# 404 error using excel vba

**URL:** <https://support.routexl.com/t/404-error-using-excel-vba/2050>\
**Category:** API\
**Created:** [October 15, 2021, 10:54am UTC](https://support.routexl.com/t/404-error-using-excel-vba/2050 "2021-10-15T10:54:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EmpiriboxWH](https://support.routexl.com/letter_avatar_proxy/v4/letter/e/eb8c5e/32.png) [@EmpiriboxWH](https://support.routexl.com/u/EmpiriboxWH)\
**Post date:** [October 15, 2021, 10:54am UTC](https://support.routexl.com/t/404-error-using-excel-vba/2050/1 "2021-10-15T10:54:20Z")

</div>

I am new to using an API. I was having a problem logging in but solved that from reading comments on this support page. I now get a ‘404’ error so I think I must be getting the link construction wrong. My code constructs the URL as:  
_[https://api.routexl.com/tour,locations=](https://api.routexl.com/tour,locations=)[{“address”:“Warehouse”,“lat”:“53.7665244”,“lng”:"-0.3304322"},{“address”:“Benenden C of E Primary School, Benenden Road, Beneden, Cranbrook, TN17 4EH”,“lat”:“51.0655159”,“lng”:“0.5790961”},{“address”:“Goudhurst and Kilndown Primary School, Beaman Close, Cranbrook Road, Goudhurst, TN17 1DZ”,“lat”:“51.1141263”,“lng”:“0.4680623”},{“address”:“Warehouse”,“lat”:“53.7665244”,“lng”:"-0.3304322"}]_

I then send it using Excel VBA with this code:  
Dim oHttp As Object  
Set oHttp = CreateObject(“MSXML2.ServerXMLHTTP”)  
Call oHttp.Open(“POST”, fn, False)  
If (authUser \<\> vbNullString) Then  
oHttp.setRequestHeader “Content-Type”, “application/json”  
oHttp.setRequestHeader “Accept”, “application/json”  
oHttp.setRequestHeader “Authorization”, “Basic " + \_  
EncodeBase64(authUser & “:” & authPass)  
End If  
Call oHttp.send(”")  
httpGET = oHttp.responseText  
Set oHttp = Nothing

and get the return message as:

404 Page Not Foundbody{margin:0;padding:30px;font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;}h1{margin:0;font-size:48px;font-weight:normal;line-height:48px;}strong{display:inline-block;width:65px;}
# 404 Page Not Found

The page you are looking for could not be found. Check the address bar to ensure your URL is spelled correctly. If all else fails, you can visit our home page at the link below.

Visit the Home Page

I would be grateful for any help.

Thank you

---

<div class="post-metadata">

**Author:** ![RouteXL](https://support.routexl.com/user_avatar/support.routexl.com/routexl/32/347_2.png) [@RouteXL](https://support.routexl.com/u/RouteXL)\
**Post date:** [October 15, 2021, 1:18pm UTC](https://support.routexl.com/t/404-error-using-excel-vba/2050/2 "2021-10-15T13:18:51Z")

</div>

We’re no VBA experts, but the constructed link seems wrong to us. It adds `locations` to the endpoint, resulting in an nonexisting path. That would explain the 404. We’d expect the locations to be added only in the `send()` command.

See: [How to perform an HTTP POST request in ASP? - Stack Overflow](https://stackoverflow.com/questions/1463635/how-to-perform-an-http-post-request-in-asp)

Note: the request should not be JSON encoded, only the _value_ of the locations parameter should be JSON.
