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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
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:
Upvote 0
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"}}
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

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
Back
Top