Key Notes#
The value of clientid corresponds to the method of obtaining the token, and they are different in the current version. Please pay close attention when calling the interface!!!
The login interface involves interface data encryption. For third-party integration, it is recommended to use authorization code authentication to obtain the token.1.1 Interface Reading Instructions#
1.
All interfaces must use the HTTP protocol, JSON data format, and UTF-8 encoding. For POST requests, please set Content-Type:application/json in the HTTP Header.
2.
Return parameter description:code: Response code, 1200 indicates success, 1401 indicates unauthorized, 1417 indicates other exceptions
data: Specific response content
tran: Internationalization related, whether to translate
{
"code": 1401,
"msg": "Session invalid, unable to access system resources, please log in again and try!",
"data": null,
"tran": true
}
All integrated APIs require a token to be obtained. The WDF system provides two acquisition methods, choose one to use. The clientId corresponding to the two methods is different, please distinguish carefully.
The account with the system's built-in authorization code is admin. If you need other accounts, please contact us to generate the client secret. The authorization code is maintained in Service Support -> Terminal Management.
The WDF system needs to decrypt and verify the client secret data. Unauthorized and self-added clients cannot obtain the token through the authorization code method.1.2.1 Authorization Code Acquisition (Recommended)#
1.2.2 Login Acquisition#
The format of the Authorization value is Bearer {{token}}. Please replace {{token}} with the actually obtained Token.Clientid is an identifier to distinguish clients, a custom value, which can be a 32-character lowercase MD5 string.
Set the HTTP Header.1.3 Example of Sending HTTP Requests with Axios in Vue 3#
1. Install Axios#
Ensure that axios is installed in your Vue 3 project. If not installed, use the following command to install:2. Create a Vue 3 Component#
Create a new component in your Vue 3 project and use the Composition API to send HTTP requests.<template>
<div>
<button @click="fetchData">Call Interface</button>
<div v-if="apiResponse">
<p>Interface Return Data: {{ apiResponse }}</p>
</div>
<div v-if="error">
<p>Error Message: {{ error }}</p>
</div>
</div>
</template>
<script>
import axios from 'axios';
import { ref } from 'vue';
export default {
setup() {
// Simulate Token and Client ID
const token = 'YOUR_ACTUAL_TOKEN';
const clientId = 'YOUR_CLIENT_ID';
// Reactive references for storing API responses and error messages
const apiResponse = ref(null);
const error = ref(null);
// Define the async function fetchData to send HTTP requests
const fetchData = async () => {
try {
// Create an axios instance and set request headers
const instance = axios.create({
baseURL: 'https://api.example.com',
headers: {
'Authorization': `Bearer ${token}`,
'Clientid': clientId
}
});
// Send a GET request to the specified API endpoint
const response = await instance.get('/endpoint');
// Store the response data in the reactive reference apiResponse
apiResponse.value = response.data;
} catch (err) {
// Catch and store error messages in the reactive reference error
error.value = err.message;
}
};
// Expose reactive references and functions to the template
return {
apiResponse,
error,
fetchData
};
}
};
</script>
3. Use the Component#
Add the above component to your Vue 3 application, and make sure to replace YOUR_ACTUAL_TOKEN and YOUR_CLIENT_ID with the actual Token and Client ID.4. Notes#
Ensure that a valid Token and Client ID have been obtained before sending the request.
Adjust the request method (GET, POST, etc.), URL, and request headers according to the API documentation.
Modified at 2026-04-13 01:14:50