cURL 复制
curl -X POST "https://cx4.cn/openApi/dev/json" -H "X-Api-Key: 你的SecretKey" -d "text={"a":1,"b":[1,2]}&action=format&path=data.list.0.name"
JavaScript 复制
fetch('https://cx4.cn/openApi/dev/json', {
method: 'POST',
headers: {
'X-Api-Key': '你的SecretKey',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: 'text={"a":1,"b":[1,2]}&action=format&path=data.list.0.name'
})
.then(res => res.json())
.then(data => console.log(data));
PHP 复制
post('https://cx4.cn/openApi/dev/json', [
'headers' => ['X-Api-Key' => '你的SecretKey'],
'form_params' => ['text' => '{"a":1,"b":[1,2]}', 'action' => 'format', 'path' => 'data.list.0.name'],
]);
echo $response->getBody();
Java 复制
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://cx4.cn/openApi/dev/json"))
.header("X-Api-Key", "你的SecretKey")
.header("Content-Type", "application/x-www-form-urlencoded")
.POST(HttpRequest.BodyPublishers.ofString("text={"a":1,"b":[1,2]}&action=format&path=data.list.0.name"))
.build();
HttpResponse response = client.send(
request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Python 复制
import requests
res = requests.post('https://cx4.cn/openApi/dev/json',
headers={'X-Api-Key': '你的SecretKey'},
data={'text': '{"a":1,"b":[1,2]}', 'action': 'format', 'path': 'data.list.0.name'})
print(res.json())