标签: httpapi

Segment.io HTTP API 不收集事件

这个特定Segment.io的文档和帮助是有限且稀疏的,所以我希望可以在这里询问。

我刚刚设置了一个 Segment.io 工作区和一个 HTTP API 源 HTTP API 源在 Segment.io UI 中可见

根据文档,我向https://api.segment.io/v1/trackhttps://api.segment.io/v1/page端点发送了一些 POST 请求(使用 Postman)。请求的结构如下:

curl -X POST \
  https://api.segment.io/v1/track \
  -H 'Accept: */*' \
  -H 'Authorization: My4w3s0m3k3y' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: application/json' \
  -H 'Host: api.segment.io' \
  -H 'Postman-Token: 474d7fbe-15af-43d2-b629-61e15945e662,2c3d5fbe-2c09-4fe6-b7ea-a04e3221201b' \
  -H 'User-Agent: PostmanRuntime/7.11.0' \
  -H 'accept-encoding: gzip, deflate' \
  -H 'cache-control: no-cache' \
  -H 'content-length: 117' \
  -d '{
  "userId": "abc123",
  "event": "My tests",
  "properties": {
    "name": "test …
Run Code Online (Sandbox Code Playgroud)

httpresponse httprequest segment-io httpapi

5
推荐指数
1
解决办法
3231
查看次数

在java中为HttpRequest添加代理

我试图了解如何为每个使用 Java API 构建的请求实现代理的使用,如下所示:

    HttpClient client = HttpClient.newHttpClient();

    HttpRequest request = HttpRequest.newBuilder()
            .version(HttpClient.Version.HTTP_2)
            .uri(URI.createh("https://myurl"))
            .timeout(Duration.ofMinutes(2))
            .setHeader("User-Agent","Just an user agent")
            .GET()
            .build();

    HttpResponse<String> response = client.send(request,
            HttpResponse.BodyHandlers.ofString());
Run Code Online (Sandbox Code Playgroud)

我从文档中看到(https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html#Asynchronous%20Example)通过请求这是可能的Synchronous。我的代码位于一个方法内,它将与线程并行运行。那么如何设置代理呢Asynchronous Requests?如果不可能,它们之间有什么区别?

java post get httprequest httpapi

5
推荐指数
1
解决办法
7761
查看次数

如何在不实际执行的情况下对HTTP DELETE操作的后果进行建模

对于HTTP API设计,我需要允许用户获取HTTP DELETE调用资源可能触发的更改列表.即如果资源是一对多关系中的父级,我将需要回复子列表.这背后的想法是客户可以在实际制作之前使用此信息来确认破坏性更改.

因此,如果实际行动很简单 HTTP DELETE /resources/uuid

HTTP DELETE /resources/uuid?simulate=true 是可以接受的,这将是在这种情况下,适当的HTTP状态代码?

我有兴趣知道这两个DELETE方案的最佳方法分两步.

api rest http httpapi

1
推荐指数
1
解决办法
27
查看次数

标签 统计

httpapi ×3

httprequest ×2

api ×1

get ×1

http ×1

httpresponse ×1

java ×1

post ×1

rest ×1

segment-io ×1