New to APIs Question

brittonsm213

New Member
Joined
Jan 4, 2016
Messages
2
I've been searching the boards, but still can't seem to find an answer to why this doesn't work. The authentication works, but when I then try to query the part number I get - "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Draft//EN"><HTML>
<HEAD>
<TITLE>Error 500--Internal Server Error</TITLE>
</HEAD>
<BODY bgcolor="white">
<FONT FACE=Helvetica><BR CLEAR=all>
<TABLE border=0 cellspacing=5><TR><TD><BR CLEAR=all>
<FONT FACE="Helvetica" COLOR="black" SIZE="3"><H2>Error 500--Internal Server Error</H2>
</FONT></TD></TR>
</TABLE>
<TABLE border=0 width=100% cellpadding=10><TR><TD VALIGN=top WIDTH=100% BGCOLOR=white><FONT FACE="Courier New"><FONT FACE="Helvetica" SIZE="3"><H3>From RFC 2068 <i>Hypertext Transfer Protocol -- HTTP/1.1</i>:</H3>
</FONT><FONT FACE="Helvetica" SIZE="3"><H4>10.5.1 500 Internal Server Error</H4>
</FONT><P><FONT FACE="Courier New">The server encountered an unexpected condition which prevented it from fulfilling the request.</FONT></P>
</FONT></TD></TR>
</TABLE>


</BODY>
</HTML>"




Here is the simple code I'm trying... And yes I know the account works, as I'm able to paste these into a IE address bar and get an XML return.

Thanks!

Public Sub Silicon_Experts_API()




strURL = "https://app.siliconexpert.com/SearchService/search/authenticateUser?login=MYACCOUNTHERE&apiKey=MYKEYHERE"
Set xmlHttp = CreateObject("MSXML2.ServerXMLHTTP.6.0")
xmlHttp.Open "GET", strURL
xmlHttp.setRequestHeader "Content-Type", "text/xml"
xmlHttp.send

'Save the response to a string
strReturn = xmlHttp.responseText


strURL = "https://app.siliconexpert.com/SearchService/search/listPartSearch?partNumber=[{" & Chr(34) & "partNumber" & Chr(34) & ":" & Chr(34) & "bav99wt" & Chr(34) & "},{" & Chr(34) & "partNumber" & Chr(34) & ":" & Chr(34) & "bav99" & Chr(34) & "}]&mode=beginwith&pageNumber=1&fmt=xml"
xmlHttp.Open "GET", strURL
xmlHttp.setRequestHeader "Content-Type", "text/xml"
xmlHttp.send

'Save the response to a string
strPartInfo = xmlHttp.responseText
Debug.Print strPartInfo
End Sub
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,829
Office Version
  1. 2010
Platform
  1. Windows
Welcome to the board.

I don't see that. What I see is for both strReturn and strPartInfo is

Code:
{"Status":{"Code":"1","Message":"Invalid User Name Or Password","Success":"false"}}
 
Last edited:

brittonsm213

New Member
Joined
Jan 4, 2016
Messages
2
Welcome to the board.

I don't see that. What I see is for both strReturn and strPartInfo is

Code:
{"Status":{"Code":"1","Message":"Invalid User Name Or Password","Success":"false"}}


I didn't post my actual User Name and Password for the API . . . . . .

strURL = "https://app.siliconexpert.com/SearchService/search/authenticateUser?login=MYACCOUNTHERE&apiKey=MYKEYHERE" when I send this I get:

{"Status":{"Code":"2","Message":"Authentication Succeeded","Success":"true"}}
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,578
Messages
5,770,956
Members
425,653
Latest member
UNSING

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top