API exception troubleshooting methods


1. Quick troubleshooting

1. Quick troubleshooting flow chart

TB1k0YFFVXXXXbFXpXXSutbFXXX.jpg

##Attachment: API document address: //open.taobao.com/api/api_list.htm?spm=a219a.7386781.0.0.g5ZY6Y

Rule center address: //open.taobao.com/doc/detail.htm?id=101612

Taobao customer service contact information: http://www.taobao.com/about/contact.php

API testing tool address: http://my.open.taobao.com/apitools/apiTools.htm

Error code list address: //open.taobao.com/doc/detail.htm ?id=101645

Forum address: //open.taobao.com/bbs/forum.php

FAQ address: //open.taobao.com/doc/detail.htm ?id=101783

Support center address: //open.taobao.com/support/index.htm?spm=a219a.7386781.0.0.r8QQcW

Emergency question group: 228708748

Detailed explanation of the problems in the flow chart

Non-API problems

Problems that occur before developers send HTTP requests for Taobao data, including Taobao Business issues, business issues, container error issues.

1. Taobao business issues:

(1) Business rule issues, such as: products or users being punished, etc.

(2) Unsuccessful operations on Taobao pages , for example: unable to view the products on sale in the Taobao backend, etc.

2. Business issues:

(1) Application access issues, such as: how many applications can a developer register, etc.

(2) Application review issues, such as: which applications do not support access, etc.

(3) Application online issues, such as: how to limit the call frequency, etc.

3 . Container error problem:

Through the container, users can authorize developers to obtain their data information, mainly errors with error codes between 100 and 200 on the page.

API issues

Problems that arise after developers send HTTP requests for Taobao data, including HTTP connection errors, platform-level errors, and business-level errors. These The three types of error problems occur at three levels: accessing Taobao servers, TOP access platforms, and Taobao back-end business servers.


1. HTTP connection error problem:

An error occurs during the request to Taobao server. This type of error is usually marked by an HTTP response code. The HTTP response code consists of three decimal digits. They appear on the first line of the response sent by the HTTP server. There are five types of response codes, represented by their first digit:

1xx: Information, request received, processing continues
2xx: Success, the action was successfully accepted, understood and adopted
3xx: Redirect, further action that must be performed in order to complete the request
4xx: Client error, the request contains a syntax error or the request cannot be fulfilled
5xx: Server error, the server cannot fulfill an obviously invalid request

When developers call the TOP service, they most often receive 200: http request successful; 404: The requested service was not found; 500 internal server error, etc. If the response code received by the developer is 404, it means there is a problem with the user's network. If the response code received by the developer is 500, it means the network is normal but the top service cannot respond.

If there is a problem with the local network, you can directly enter the command line ping gw.api.taobao.com to test the speed of requesting the Taobao server. If the speed is very slow, consider speeding up the server. If the ping fails, please contact The network administrator confirms whether the server blocks the Taobao domain name.

2. Platform-level error problem:
An error occurs when requesting TOP to access the platform. At this time, the error code returned by TOP is less than 100. This error is generally caused by the user's request not complying with permissions and security. Caused by verification of traffic flow and the most basic parameters.

3. Business-level error problem:
When requesting a problem with the back-end business server, the error code returned is between 500 and 1000. For specific sub-error codes and solutions, please refer to the API documentation.

2. Detailed troubleshooting flowchart

Details the developer's processing flow after discovering the above problems.

T1jOVMXbxCXXaMCXbX.jpg

##3. Example of quick troubleshooting

Example 1I analyzed from the error log that taobao.item.recommend.add reported isv.item-recommend-service- error:ERROR_MORE_THAN_ALLOWED_RECOMMEND_NUM (exceeded the total number of window recommendations). There are many errors. How to solve them? Woolen cloth?

First locate the API problem according to the troubleshooting process, and then check the error code solution in the API document:

1. When recommending the window, the user is required to enter the total amount of the window recommendation. Some users You will lose more, so you will report the error that the window recommendation exceeds the maximum number of recommendations. The total number of windows will be updated regularly every day. The total number of windows = the remaining windows of the recommended windows (this error cannot be completely eliminated)

2. The developer first calls The taobao.shop.remainshowcase.get interface obtains the seller's remaining number of showcases, makes logical judgments, and then calls the showcase recommendation interface.

Example 2

The local program reports a connection reset error and no top error code is returned. How to solve this kind of problem?

Suggestions:

1. Reasonably cut tasks, reduce task granularity, reduce transaction time, improve transaction execution success rate, and reduce rollback cost;

2. Merge repeated content in tasks and reduce possible repeated operations within the allowable time interval;

3. See if there is a batch operation interface to reduce the number of single loop calls;

4. Control the number of threads in the worker thread pool, and set the number of parallel tasks according to the actual performance and the processing capacity of the other server:

The more threads developed concurrently, the higher the success rate may not be!

First of all, local resources are limited (the more threads are opened, the higher the frequency of local GC recycling, which affects the execution speed and reduces the efficiency);

Secondly, the other party may Actively reject the connection because you have too many IP connections; (DOS protection)

Again, the channel cannot be reused. (The current 1.6 JDK version has been able to better reuse TCP channels. Opening a large number of TCP channels simultaneously is a loss in itself. Sometimes partial serialization will reduce the number of TCP channels generated to a certain extent and use the channels rationally. To improve efficiency and success rate, it is also important for the client to do flow control)

Example 3

Solution to network packet loss problem:

Problem background:

1. Since the reliability of Internet physical lines is not 100%, there is data loss in the communication between the ISV server and TOP

2. Developers need a A method to verify whether the data obtained during each access is complete and whether there is any packet loss

3. Currently, some ISVs use this method to verify integrity: calling the API multiple times in a row and comparing the returned results. If they are exactly the same, they are considered complete. This method is unreliable (multiple calls may return different business results), increases ISV development costs, and also increases TOP's server pressure

Solution:

In order to solve In response to developer feedback on ISV verification data integrity issues, TOP has added a new element to the HTTP Header: top-bodylength.

How to use: The developer gets the value of this top-bodylength and calculates the length of the received HTTP Body. If the two are equal, it means that the returned data is complete. If the length of the HTTP Body is calculated, A value smaller than top-bodylength indicates that packet loss has occurred.

Note:

1: TOP does not change the HTTP Body, so it will not have any impact on existing applications.

2: top-bodylength is the length of String characters representing the HTTP Body (both Chinese and English are counted as 1 length)

2. List of error codes

#1. Currently there are three types of errors that may occur when developers call APIs: API platform errors, ISV business errors and container errors. The following is an introduction to the nouns related to ISV success rate:

Effective visits = successful visits ISV business errors (successful visits refer to calls that obtain data normally and report no errors)

ISV success rate = successful visits/effective visits

2. Errors in connecting to Taobao server are mainly http connection errors or connection re- Settings are rejected, etc. This type of error is a problem caused by developers accessing Taobao servers. Please contact the server administrator directly or search for answers on the Internet.

1. API platform errors

API platform errors mainly include two types of errors:

(1) Call errors with error codes less than 100 (excluding error codes 15, 40, and 41). This error is generally caused by the user's request not complying with various basic checks. When users encounter these errors, they first check the application's permissions, frequency, etc., and then refer to the documentation to check whether the incoming parameters are complete and legal.

(2) The sub-error code (sub_code) is a calling error starting with "isp.". This error is generally caused by server-side exceptions. Users who encounter this type of error need to try again after a period of time to resolve it.

Platform-level error with error code less than 100
Error code Error description - English error description - Chinese solution 3Upload Fail Image upload failed. Change the incoming image format to the correct format and appropriate size. Enter the message body and transmit it. If the transmission still fails, you need to reduce the image size or increase the network bandwidth and try. 7App Call Limited The number of application calls exceeds the limit, including calling the frequency limit adjustment program to properly call the API. Wait until the frequency limit time has passed before calling again. , the calling frequency of Taoke is automatically modified by the system according to the transaction volume of the previous month. The modified frequency will be notified in the form of an announcement on the official forum homepage. Developers can check it themselves. 9Http Action Not AllowedHTTP method is prohibited. Please use POST or capital letters. GET, if there are pictures and other information coming in, you must use POST. 10Service Currently Unavailable Service unavailability is mostly caused by unknown exceptions. Carefully check whether the parameters passed in comply with the document description. 11Insufficient ISV PermissionsInsufficient developer permissions sub-error code Currently, isv.permission-api-package-empty is not associated with any access package. It is recommended to apply for the corresponding permissions according to business rules. isv.permission-api-package-not-allowed does not allow access to the API of the inaccessible group. It is recommended to check yourself. Is the applied application tag correct? If you really need to access the API of the inaccessible group, you need to apply for permissions from the corresponding business line according to the business rules. For example: in the buyer inaccessible group, there will be some order APIs that do not allow the buyer application to access isv.permission- The API is not allowed to be accessed in the package associated with api-package-limit. It is recommended to apply for the corresponding permission isv.permission-ip-whitelist-limit according to the business rules. IP restrictions do not allow access. It is recommended to configure the correct IP whitelist isv in the security center. permission-api-widget-only-limit only allows widget (component) access 12Insufficient User Permissions Insufficient User Permissions The application does not have permission to call the interface of value-added permissions. Permission applications can be submitted in the Taobao partner backend 13Insufficient Partner Permissions Insufficient partner permissions The application does not have Permissions call the interface for value-added permissions. You can submit permission applications in the Taobao partner backend. 21 Missing Method is missing the method name parameter. The incoming parameters are added to the method field. 22 Invalid Method The method name does not exist. The incoming method field must be the name of the API you are calling. , and the API does exist 23Invalid Format Invalid data format The format passed in must be one of json or xml 24Missing Signature The signature parameter is missing The incoming parameter must contain the sign field 25Invalid Signature Invalid signature The signature must be based on the correct algorithm Calculate it.For the algorithm, please see: //open.taobao.com/doc/detail.htm?id=101617#ss226Missing Session is missing the SessionKey parameter. The passed-in parameters must contain the session field. 27Invalid Session, unmix-sessionkey-failure Invalid SessionKey parameter is passed in. The session must be obtained by the user binding the session. If the reported session is illegal, it may be caused by the user not binding the session or the session has expired. The user needs to rebind and then pass in a new sessionKey28Missing App Key is missing the AppKey parameter passed in Parameters must include the app_key field 29Invalid App Key Invalid AppKey parameter The environment in which the application is located is inconsistent with the selected environment. For example: the application is in a sandbox testing environment but chooses to be tested in the official environment. 30Missing Timestamp is missing the timestamp parameter. The passed in parameter must contain the timestamp parameter. 31Invalid Timestamp is an illegal timestamp parameter timestamp. The format is yyyy-mm-dd hh:mm:ss, for example: 2008-01-25 20:23:30 . The Taobao API server allows the client to request a time error of 10 minutes. 32 Missing Version is missing the version parameter. The incoming parameter must contain the v field. 33 Invalid Version. Illegal version parameter. The version number passed by the user has an incorrect format and must be in numeric format. 34 Unsupported Version is not supported. The version number passed in by the user was not provided. 42Insufficient session permissions short authorization permissions are insufficient. The high-risk API is being called. Please refer to the security level document //open.taobao.com/doc/detail.htm?id=100243 Parameter Error. It is usually caused by illegal parameters passed in by the user. Please carefully check whether the format and range of the input parameters correspond to one-to-one 44Invalid access token. Invalid access token is usually the session key obtained by the user using the top protocol and used as an access token to call the API or call the environment through https. Error 47Invalid encoding encoding error is generally caused by the user not using UTF-8 encoding when making http requests

Platform level sub-error

Sub error code format error information Whether the owner can retry isp.***-service-unavailable in the program to call the back-end service *** throws an exception, the service is unavailable ISP is isp.remote-service-error Connection to remote service error ISP is isp.remote-service-timeout Connection to remote service timeout ISP is isp.remote-connection-error Remote connection error ISP is isp.null-pointer-exception Null pointer exception error ISP No isp.top-parse- errorapi parsing error (an exception message that is not explicitly controlled occurred) ISP No isp.top-remote-connection-timeouttop Platform connection backend service timeout ISP Yes isp.top-remote-connection-errortop Platform connection backend service error, find The service ISP is isp.top-mapping-parse-errortop-mapping conversion error, mainly because the incoming parameter format is incorrect. ISP No isp.unknown-errortop Platform connection back-end service throws unknown exception information ISP is

##2. ISV business error

1.ISV business-level errors are errors caused by missing, incorrect or formatted parameters passed in by the ISV. Therefore, isv should check whether the corresponding information has been passed in based on the error message. For this type of error, it is recommended to correct it and try again.

mainly includes two categories:

(1) Errors with error codes 40 and 41; 40 is mainly a required parameter There is no incoming error. 41 is mainly due to the incorrect format of the incoming parameters. :2.

##(2) The error code is greater than 100 or equal to 15 and the sub-error code (sub_code) starts with "isv."

[(Error code> 100 or error Code = 15 ) and (starting with isv)] calling error:

2. The error response is the most direct manifestation of the failure of interaction between the user and the server. When isv calls the top service , if the call fails, please try to keep the error log for later error tracing.

3, 40/41 Error Introduction

Error code Error description - English error description - Chinese solution 40Missing Required Arguments Missing required parameters The parameters set as required in the API document are required, please check the document carefully 41Invalid Arguments Illegal parameter The parameter type is wrong. For example: the parameter that needs to be passed in is a numeric type, but a character type parameter is passed in

4. Whether the owner of the business-level sub-error

sub-error code format error message can retry in the program isv.-not-exist:* **Not found according to ***The incoming parameters *** and do not match, both There is a certain corresponding relationship ISV No isv.***-service-error: Calling *** service returns false, business logic error,
ISV No isv.missing-parameter:***Missing necessary parameters***ISV No isv.invalid-paramete:***Parameter*** is invalid, the format is wrong, ISV value, out of bounds, etc. ISV No isv.invalid-permission is not enough, illegal access ISV No isv.parameters-mismatch:***-and-
indicates the specific error message ISV No ######## ####

3. Security level and security vulnerability error code

Parent error code information

Sub-error code information

error code

##English description

Chinese description

##Solution

#53

Insufficient security level

Insufficient security level

# #Increase the application security level or refresh the authorization security level

##Sub error code information

##Chinese description

Official party

##Solution

high-risk security breach

There is a high-risk security vulnerability

ISV

Re-release after fixing the security vulnerability

mid-risk security breach

There is a mid-level security breach

ISV

Re-release after fixing the security vulnerability

R1 security authorize missing

R1 not performed Level Authorization

##ISV

Perform R1 level authorization (user re-authorization or refresh authorization)

R1 security authorize invalid

R1 level authorization expired

ISV

Perform R1 level authorization (user re-authorization or refresh authorization)

R2 security authorize missing

No R2 level authorization

ISV

## Perform R2 level authorization (user re-authorization or refresh Authorization)

R2 security authorize invalid

R2 level authorization expired

##ISV

Perform R2 level authorization (user re-authorization or refresh authorization)

##W1 security authorize missing

No W1 level authorization

ISV

## Perform W1 level authorization (user re-authorization or refresh Authorization)

W1 security authorize invalid

W1 level authorization expired

##ISV

Perform W1 level authorization (user re-authorization or refresh authorization)

##W2 security authorize invalid

No W2 level authorization

ISV

## Perform W2 level authorization (user re-authorization or refresh Authorization)

W2 security authorize invalid

W2 level authorization expired

##ISV

Perform W2 level authorization (user re-authorization or refresh authorization)

##4. Other unique error codes

QQ截图20170213173848.png

FAQ

There is no FAQ about this document