Routes Preferred API는 현재 일부 고객만 이용할 수 있습니다. 자세한 내용은
영업팀에 문의하세요.
반환할 필드 선택
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
ComputeRoutes()
메서드를 호출할 때는 응답에 반환할 필드를 지정해야 합니다. URL 매개변수 $fields
또는 fields
로 제공하는 응답 필드 마스크를 사용하거나 HTTP/gRPC 헤더 X-Goog-FieldMask
를 사용하여 이 작업을 실행할 수 있습니다. 자세한 내용은 시스템 매개변수를 참고하세요.
필드 마스크
필드 마스크 값은 쉼표로 구분된 필드 경로 목록입니다. 각 필드 경로는 메시지 계층 구조를 나타내는 필드 이름의 목록으로, 점으로 구분됩니다. 필드 이름은 JSON 객체 키 또는 protobuf 필드 태그 이름입니다. 필드 경로는 최상위 응답 메시지 유형에서 시작하며, 원하는 경우 하나 이상의 점과 다음 수준의 필드 이름이 뒤에 올 수 있습니다. 일반적으로 필드 경로는 다음과 같이 구성됩니다.
topLevelField[.secondLevelField][.thirdLevelField][...]
특수한 필드 마스크는 모든 루트 수준 필드를 선택하는 와일드 카드인 “*”입니다.
예
다음 예는 ComputeRoutes()
메서드의 필드 마스크를 설정하는 방법을 보여줍니다.
예 1
사용 가능한 모든 필드의 필드 마스크 (수동 검사용)
X-Goog-FieldMask: *
예 2
경로 수준 시간, 거리, 다중선의 필드 마스크 (프로덕션 설정 예시)
X-Goog-FieldMask: routes.duration,routes.distanceMeters,routes.polyline
프로덕션에서는 와일드 카드 (*) 응답 필드 마스크를 사용하거나 최상위 수준 (라우트)에서 필드 마스크를 지정하지 않는 것이 좋습니다. 필요한 필드만 선택합니다.
서버에서 처리 주기를 절약할 수 있으므로 지연 시간이 짧은 결과를 반환할 수 있습니다.
안정적인 지연 시간 성능을 보장합니다. 향후 더 많은 응답 필드가 추가될 수 있으며, 이러한 새 필드에는 추가 계산 시간이 필요할 수 있습니다. 모든 필드를 선택하거나 최상위 수준에서 모든 필드를 선택하면 추가된 새 필드가 응답에 자동으로 포함되므로 성능이 저하될 수 있습니다.
결과적으로 응답 크기가 줄어들어 네트워크 처리량이 증가합니다.
필드 경로를 구성하는 방법에 관한 자세한 내용은 field_mask.proto를 참고하세요.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-11-23(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2024-11-23(UTC)"],[[["When calling the `ComputeRoutes()` method, specify desired response fields using a field mask with the `$fields` URL parameter, `fields` URL parameter, or `X-Goog-FieldMask` HTTP/gRPC header."],["Construct field masks as comma-separated lists of dot-separated field paths representing the message hierarchy starting from the top-level response."],["For production, avoid using wildcard field masks or selecting all top-level fields to improve performance, ensure stable latency, and reduce response size."],["Selecting specific fields instead of all fields minimizes server processing, safeguards against potential performance degradation from future response field additions, and enhances network throughput."]]],["To specify which fields to return from the `ComputeRoutes()` method, use a response field mask via the `$fields`, `fields` URL parameter, or the `X-Goog-FieldMask` header. Field masks use comma-separated field paths, formatted as `topLevelField[.secondLevelField]`. Avoid the wildcard `*` or top-level `routes` in production. Instead, specify needed fields, like `routes.duration,routes.distanceMeters,routes.polyline`, to reduce latency, ensure stable performance, and decrease response size.\n"]]