데이터 작업을 위한 URI(URL) 형식 인코딩

메모 : 이 문서는 Function, Genesys Cloud, Google, Microsoft Dynamics 365, Salesforce, 웹 서비스 및 Zendesk 데이터 작업 통합에 적용됩니다.

일부 API, 특히 로그인 API에는 HTTP 요청에 대한 URL 형식 인코딩이 필요합니다. URI 인코딩을 위한 Genesys Cloud 데이터 작업을 구성하려면:

  1. 생성하다Content-Type 값이 있는 요청 헤더x-www-form-urlencoded .

  2. 설정하다 요청 본문 템플릿 UI에서 또는requestTemplate JSON 또는 Terraform 형식으로 매개변수를 앰퍼샌드(&)로 구분한 키-값 쌍으로 지정합니다. 예를 들어,key1=value1&key2=value2 .

    참고: The request body is not JSON, it is a string formatted as URL query arguments.

  3. 사용$esc.uriEncode() /와 같은 URL 예약 문자가 포함된 값이나 변수 주위 ? : @ – . _ ! ~ $ & ' ( ) * + , ; =.

JSON example

"config": { 
     "request": { 
          "requestTemplate": "grant_type=client_credentials&scope=customers_read_write&audience=$esc.uriEncode(\"https://api.example.com/v1/customers\")", 
          "headers": { 
               "Authentication": "Basic $encoding.base64(\"${credentials.clientid}:${credentials.clientSecret}\")", 
               "Content-Type": "application/x-www-form-urlencoded" 
               },
          "requestType": "POST", 
          "requestUrlTemplate": "${credentials.loginUrl}" 
       } 
   } 

The following example shows the user input values that have the reserved characters:

"config": {
	"request": {
		"headers": {
			"Content-Type": "application/x-www-form-urlencoded"
		},
		"requestUrlTemplate": "https://api.example.com/v1/customers",
		"requestTemplate": "description=$esc.uriEncode(\"${input.DESCRIPTION}\")&email=$esc.uriEncode(\"${input.EMAIL}\")",
		"requestType": "POST"
	}
}
메모 : 주입 공격으로부터 보호하려면 항상 다음을 사용하십시오.$esc.uriEncode() 사용자 입력을 통한 기능. 데이터 작업은 특수문자를 사용한 사용자 입력을 자동으로 이스케이프할 수 없으므로 보안 목적으로 해당 기능을 사용해야 합니다. 데이터가 Architect나 Script를 포함한 호출된 엔터티에서 나오더라도 URL과 URL 양식을 처리할 때는 이스케이프를 수행해야 합니다.

통합에 대한 자세한 내용은 다음을 참조하십시오. 데이터 작업 통합 정보.