|
Sign Up
Contact Us

API Quick Start

Signing Up

Login to PatSnap using your credentials and check your package access in the account data center page. Self-registration is not currently available for your account.

API Credentials

Once you get the API package usage, log in the system and go to the Personal Center Page. Your API credentials are a Client ID and a Client Secret .

The packages and package usages are on the same page. You can find how many API calls can be made and have been made.

Bearer Authentication

1. Generate Authorization based on Base64 encoding rules through Client ID and Client Secret;
2. Carry Authorization as the request header to request a token;
3. Note: The token is valid for 30 minutes.

 

Client ID is b4562e4188asd4cb486a19c6971515c66.
Client Secret is N1eOgd8sOk4z1vaWQfB18P4AbSk70lGs.
You can form the POST command as below to get the Bearer.
For example:
  • Curl
  • NodeJS
  • Python
  • Java
curl -X "POST" "https://connect-patsnap-com.libproxy1.nus.edu.sg/oauth/token" \
    -H "Content-Type: application/x-www-form-urlencoded " \
    -u b4562e4188asd4cb486a19c6971515c66:N1eOgd8sOk4z1vaWQfB18P4AbSk70lGs \
    -d "grant_type=client_credentials"
const request = require('request');
request.post(
    {
        // eslint-disable-next-line no-template-curly-in-string
        url: 'https://b4562e4188asd4cb486a19c6971515c66:N1eOgd8sOk4z1vaWQfB18P4AbSk70lGs@connect-patsnap-com.libproxy1.nus.edu.sg/oauth/token',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
        },
        form: 'grant_type=client_credentials',
    },
    (err, res, body) => {
        if (!err) {
            console.log(body);
        } else {
            console.log('error authenticate', err);
        }
    }
);
import requests
url = "https://b4562e4188asd4cb486a19c6971515c66:N1eOgd8sOk4z1vaWQfB18P4AbSk70lGs@connect-patsnap-com.libproxy1.nus.edu.sg/oauth/token"
payload = "grant_type=client_credentials"
headers = {
    "content-type": "application/x-www-form-urlencoded"
}
response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
public static void main(String[] args) {
    String host = "https://b4562e4188asd4cb486a19c6971515c66:N1eOgd8sOk4z1vaWQfB18P4AbSk70lGs@connect-patsnap-com.libproxy1.nus.edu.sg";
    String path = "/oauth/token";
    Map headers = new HashMap();
    headers.put("Content-Type", "application/x-www-form-urlencoded");

    Map requestbody = new HashMap();
    requestbody.put("grant_type", "client_credentials");

    try {
        /**
        * Important Tips:
        * Please Download HttpUtils From
        * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java
        *
        * Please refer to the corresponding dependence:
        * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml
        */
        HttpResponse response = HttpUtils.doPost(host, path, null, headers, null, requestbody);
        System.out.println(EntityUtils.toString(response.getEntity()));
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Copy

The content returned is as follows.

  • json
{
    "token": "token_example",
    "token_type": "BearerToken",
    "expires_in": 1799,
    "status": "approved",
    "issued_at":"1692347672874"
}
Copy

Business APIs

After you get the Bearer, you can use it to access the business APIs according to your package.

For Example if you want to get the patent information by patent number. You can GET With apikey, Header X-PatSnap-Version and Header Authorization, the apikey is the client id, the X-PatSnap-Version is the version number of the API which you request, the Authorization is Bearer [Bearer]

Here is how the command organized. (Please note the space between "Bearer" and "token_example")

Version in Header

The service useX-PatSnap-Version header to request for specified version of response.

TheX-PatSnap-Version header like the format below:

  • json
{
  "X-PatSnap-Version": "[API Version]"
}
Copy
The [API Version] means the version of the resource. e.g.
  • json
{
  "X-PatSnap-Version": "1.0"
}
Copy