Parts Cross Reference web-service
Идёт загрузка страницы.
Осталось
Function articles/info is used to get the list of crosses, part images and some other specifications (weight, description, etc.). The set of specifications depends on the goods. Some goods may not have images.

Getting the item card

Operation: articles/info
Method: GET

Returns information about specified item.

Request parameters

ParameterDescription
userlogin User login in the system
userpsw md5-hash of user password in the system
brand Brand name
number Part number
format Format of the answer. Values include: [b][n][p][c][h][m][t][i] - output format (b - brand name, n - part number, p - properties, c - crosses, h - locale-sensitive properties, m - information about model, t - outpute types of crosses considering direction, i - images)
locale Locale. Should be in format language[_territory], for example, en_US.

Example of request

http://api.parts-cross-reference.com/articles/info?userlogin=username&userpsw=md5pass&brand=Nokian&number=TS31671&format=bnpich&locale=en_US

Method returns an array of objects:
ParameterDescription
brand Brand name
number Part number
outer_number Part number containing gaps, slashes and other characters
properties An array of properties of the item: description, weight, volume, etc. (format [p])
rating Item rating
crosses An array of information about analogues (format [c])
images An array of images (format [i]).
Function search/brands is used to get the list of brands for specified number (article). Typically used in the first stage of the search algorithm, when a user searches for parts by number, which correspond to different brands.

Search brand by number

Operation: search/brands
Method: GET

Search by part number and return an array of brands which have the items with required part number. Tihs is an analogue of selection the brand on the site.

Request parameters

ParameterDescription
userlogin User login in the system
userpsw md5-hash of user password in the system
number Part number
useOnlineStocks Check-box "Use online-stocks". Values include 0 or 1 (don't use and use respectively; default - 0). When value is 0 there aren't items from online-stocks in the array. This increases the speed of response.
locale Locale. Should be in format language[_territory], for example, en_US.

Example of request

http://api.parts-cross-reference.com/search/brands/?userlogin=username&userpsw=md5pass&number=403730&locale=en_US

Response fields:
FieldDescription
brand Brand name
number Part number
numberFix "Cleaned" number containing only alphabetic and numeric characters
description Item description
availability Mark "availability"
Function search/tips returns the pair "brand/number" for prompting the user by the first characters typed. The function tries to give hints on the most commonly sought products.

Search tips

Operation: search/tips
Method: GET

Return an array of brand-number pairs that matches to several characters of part number.

Request parameters

ParameterDescription
userlogin User login in the system
userpsw md5-hash of user password in the system
number Part number or several characters of part number

Example of request

http://api.parts-cross-reference.com/search/tips?userlogin=username&userpsw=md5pass&number=А113094

Method returns an array of objects:
FieldDescription
brand Brand name
number Part number
rating Item rating

Access to the API is provided by the HTTP-requests and implemented using the principles of REST. Basic URI for web-service is:

http://api.parts-cross-reference.com/

The exchange is performed in the UTF-8 encoding.
For debugging you can use a Google Chrome extension Advanced REST Client.

Request

Requests for receiving and recording data performed using HTTP GET and POST methods, respectively. There is the concept of operations in service structure. The operation is indicated as the path in the URL. Parameters are passed as a query string HTTP (GET) or POST data. Most of the operations perform on behalf of a specific user and requires authentication using parameters userlogin (user login in the system) and userpsw (md5-hash of user password in the system). Md5-hash can be generated by programming function (most programming languages have this feature), or use the online-generator (eg, md5x). Every operation may have a list of additional parameters defined by the context. For example, request operation "Search items by number" could be as follows:

GET http://api.parts-cross-reference.com/articles/info/?userlogin=***&userpsw=***&brand=Mercedes-Benz&number=A1130940048&format=bnphic&locale=en_US

When using the POST method in HTTP-Content-Type header to be transmitted media data type of query application / x-www-form-urlencoded and according to the type of body from the HTTP-request. It's nesessary to transmit media-type of request data in HTTP-header Content-Type when using POST method and it needs to generate the body of HTTP-request with this media-type.

The HTTP-header Accept needs to transmit the expected type of response data. Currently implemented only JSON type and, in any case, it will be returned. However, in developing it's necessary to take into account the specified feature and transmit Accept header with a value application/json.

Response

In case of successful execution of the operation the web service returns a response with HTTP-200 code and the response body in JSON. The format of the response is determined by each operation. Example of a successful request:

{
 "brand": "MERCEDES-BENZ",
 "number": "A1130940048",
 "short_number": "1130940048",
 "outer_number": "A 113 094 00 48",
 "properties": {
  "weight": "0.248",
  "descr": "Mass Air Flow Sensor"
 },
 "images": [
  {
   "name": "00296fd49ba2b385e441829fc0b2913ea6.jpeg",
   "order": 0
  }
 ],
 "is_skipped_image": false,
 "images_count": 1,
 "rating": 112,
 "rating_4mycar": 88,
 "crosses": [
  {
   "brand": "ASHUKI",
   "number": "116617A",
   "numberFix": "116617A"
  },
  {
   "brand": "BBT",
   "number": "AMS405",
   "numberFix": "AMS405"
  }
 ]
}

Response with HTTP-code 400 and more is an error. The response body contains an error code and, as a rule, a text message describing the causes of the errors in JSON. An example of an error message:

  { 
    "errorCode": 102,
    "errorMessage": "User Authentication Error"
  }