User Status
Retrieves user status data for the account you authenticated with
URL format: ProductAPI/search/userStatus?
Inputs
Optional parameters
fmt
: format of the response (JSON or XML) default is JSON.
Sample request
- Gets User Status information.
<a href="https://api.siliconexpert.com/ProductAPI/search/userStatus"> https://api.siliconexpert.com/ProductAPI/search/userStatus</a>
Outputs
-
- CreationDate.
- ExpirationDate.
- PartDetailLimit.
- PartDetailCount.
- PartDetailRemaining.
- AclPartsCount
There is no snippet for this language. Please select another.
Imports System.Net
Imports System.IO
Module Module1
Sub Main()
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
Dim userName As String = ""
Dim passwors As String = ""
Dim request As HttpWebRequest =
WebRequest.Create("https://api.siliconexpert.com/ProductAPI/search/authenticateUser?login=" + userName + "&apiKey=" + password)
Dim cookieJar As CookieContainer = New CookieContainer()
request.CookieContainer = cookieJar
Dim response As HttpWebResponse = request.GetResponse()
request = WebRequest.Create("https://api.siliconexpert.com/ProductAPI/search/userStatus")
request.CookieContainer = cookieJar
response = request.GetResponse()
Dim dataStream As Stream = response.GetResponseStream()
' Open the stream using a StreamReader for easy access.
Dim reader As New StreamReader(dataStream)
' Read the content.
Dim responseFromServer As String = reader.ReadToEnd()
' Display the content.
Console.WriteLine(responseFromServer)
Console.ReadLine()
reader.Close()
response.Close()
End Sub
End Module
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Threading;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
String username = "";
String password = "";
HttpWebRequest request =
(HttpWebRequest)WebRequest.Create("https://api.siliconexpert.com/ProductAPI/search/authenticateUser?login=" + username + "&apiKey=" + password);
CookieContainer cookieContainer = request.CookieContainer = new CookieContainer();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
String searchUrl =
"https://api.siliconexpert.com/ProductAPI/search/userStatus";
request = (HttpWebRequest)WebRequest.Create(searchUrl);
request.CookieContainer = cookieContainer;
request.Accept = "application/json";
response = (HttpWebResponse)request.GetResponse();
String results = new System.IO.StreamReader(response.GetResponseStream(), ASCIIEncoding.ASCII).ReadToEnd();
Console.WriteLine(results);
Console.ReadLine();
}
}
}
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.CookieHandler;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import javax.net.ssl.SSLContext;
public class SiliconExpertAPIJava
{
public static void main(String[] args) throws IOException, KeyManagementException, NoSuchAlgorithmException
{
// For java 7 and lower
SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
sslContext.init(null, null, null);
SSLContext.setDefault(sslContext);
String userName = "";
String password = "";
String authinticationURL = "https://api.siliconexpert.com/ProductAPI/search/authenticateUser?login=" + userName + "&apiKey=" + password;
String searchURL = "https://api.siliconexpert.com/ProductAPI/search/userStatus";
CookieManager manager = new CookieManager();
manager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
CookieHandler.setDefault(manager);
URL url = new URL(authinticationURL);
URLConnection connection = url.openConnection();
connection.getContent();
url = new URL(searchURL);
connection = (HttpURLConnection) url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuffer responseString = new StringBuffer();
while((inputLine = in.readLine()) != null)
responseString.append(inputLine);
in.close();
// Process the response
System.out.println(responseString);
}
}
import urllib.parse
import urllib.request
import http.cookiejar
cookies=http.cookiejar.CookieJar()
handlers = [
urllib.request.HTTPHandler(),
urllib.request.HTTPSHandler(),
urllib.request.HTTPCookieProcessor(cookies)
]
userName=""
password=""
url = 'https://api.siliconexpert.com/ProductAPI/search/authenticateUser?login='+userName+'&apiKey='+password
req = urllib.request.Request(url)
opener = urllib.request.build_opener(*handlers)
o=opener.open(req)
searchUrl='https://api.siliconexpert.com/ProductAPI/search/userStatus'
req = urllib.request.Request(searchUrl)
opener = urllib.request.build_opener(*handlers)
o=opener.open(req)
print(o.read().decode('utf-8'))
# 1) Creating a new directory (if not exists) to save cookies.
mkdir /tmp/siliconexpert
# 2) Creating a new file (if not exists) to save cookies.
touch /tmp/siliconexpert/cookies
# 3) Authentication (if not authenticated or session expired).
# -d (Send specified data in POST request).
# -X (The request method to use).
# login (Your API username).
# apiKey (Your API password).
curl -c /tmp/siliconexpert/cookies -d "login=my_username&apiKey=my_password" -X
POST https://api.siliconexpert.com/ProductAPI/search/authenticateUser
# 4) Calling the API.
curl -b /tmp/siliconexpert/cookies -X
POST https://api.siliconexpert.com/ProductAPI/search/userStatus
var http = new XMLHttpRequest();
var url = "https://api.siliconexpert.com/ProductAPI/search/authenticateUser";
var searchURL='https://api.siliconexpert.com/ProductAPI/search/userStatus';
var params = 'login=youtuserName&apiKey=yourApiKey';
http.open("POST", url, true);
http.onreadystatechange = function() {
if(http.readyState == 4 && http.status == 200) {
http.open("POST", searchURL, true);
http.onreadystatechange = function() {
if(http.readyState == 4 && http.status == 200) {
alert(http.responseText);
}
}
}
}
http.send(params);
{
"Status": {
"Code": "0",
"Message": "Successful Operation",
"Success": "true"
},
"UserStatus": {
"CreationDate": "Aug 06, 2017",
"ExpirationDate": "Jan 24, 2020",
"PartDetailLimit": "Unlimited",
"PartDetailCount": "176",
"PartDetailRemaining": "Unlimited",
"AclPartsCount": "3427"
}
}