Webpage API Invocation via Dynamic JS URL Mapping

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods for invoking APIs in webpages require encoding URLs in a specific format, which is complex, time-consuming, and lacks compatibility with different client versions, necessitating frequent modifications when encoding rules change.

Innovation Solution

A method and apparatus that load a prestored JavaScript file with JS URLs corresponding to different APIs, allowing the webpage to send an invoking request with a JS URL to the client, enabling the client to invoke the corresponding API without needing to modify encoded URLs, thus simplifying operations and reducing compatibility issues across client versions.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of operation

If URLs in specified format are encoded into the webpage in advance, then the API can be invoked by the webpage, but when the encoding rule changes, the encoded URL in each webpage needs to be modified, which is complicated in operation and wastes time

Engineering Contradiction:
Improveoperation complexityVSAvoidtime consumption
Core Design Contradiction:
Ease of operationVSLoss of time

Solution Approach 1:

The client pre-generates and provides JS URLs to the webpage in advance, so that when the encoding rule changes, only the client needs to be updated, not the webpage. This preliminary action resolves the contradiction by shifting the update burden from frequent webpage modifications to a single client update.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent introduces JS URLs as an intermediary between the client and the webpage. Instead of directly encoding complex URLs into the webpage, the system uses JS URLs that the client can generate and provide dynamically, simplifying the webpage's invocation process while maintaining flexibility for encoding rule changes.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Adaptability or versatility

If URLs in specified format are encoded into the webpage in advance, then the API invocation can be implemented, but it lacks compatibility with clients in different versions

Engineering Contradiction:
ImprovecompatibilityVSAvoidsystem complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The client performs preliminary generation of JS URLs based on its own version and encoding rules, then provides these to the webpage. This allows different client versions to provide appropriately formatted JS URLs without requiring the webpage to be aware of or adapt to each version's specific encoding rules, thereby improving compatibility.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system changes the parameter format from fixed encoded URLs in the webpage to dynamic JS URLs provided by the client. This parameter change allows the client to adjust the URL format according to its version and encoding rules, enhancing adaptability across different client versions while the webpage maintains a simple, unified invocation interface.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS10853437B2Method and apparatus for invoking application programming interface
Publication Date: 2020.12.01 TENCENT TECHNOLOGY (SHENZHEN) CO LTD
  • US10853437B2 patent drawing
  • US10853437B2 patent drawing
  • US10853437B2 patent drawing

AI summary

A method and an apparatus for invoking an application programming interface (API) are disclosed. The method includes: loading a prestored JS file to a webpage after loading of the webpage is completed; receiving an invoking request that is sent by the webpage by invoking the JS file; and invoking a corresponding API according to a JS URL. This solves a problem that an encoded URL in each webpage needs to be modified when an encoding rule of a URL in a specified format is changed, which is complicated in operation, wastes time, and is poor in compatibility with clients in different versions.