2013-10-04 2 views
0

다음 복잡한 유형을 매개 변수로 사용하여 HTTP POST를 HTTP POST에 보내야합니다. 저지에 관한 문서를 살펴봤을 때만 키 값 쌍을 보내는 데 도움이됩니다. 저지를 사용하여 아래 매개 변수로 HTTP Post 요청을 보내려면 어떻게해야합니까?복잡한 매개 변수가있는 저지를 사용하여 HTTP 포스트 요청을 보내는 방법

{ 
    "key": "example key", 
    "message": { 
     "html": "<p>Example HTML content</p>", 
     "text": "Example text content", 
     "subject": "example subject", 
     "from_email": "[email protected]", 
     "from_name": "Example Name", 
     "to": [ 
      { 
       "email": "[email protected]", 
       "name": "Recipient Name" 
      } 
     ], 
     "headers": { 
      "Reply-To": "[email protected]" 
     }, 
     "important": false, 
     "track_opens": null, 
     "track_clicks": null, 
     "auto_text": null, 
     "auto_html": null, 
     "inline_css": null, 
     "url_strip_qs": null, 
     "preserve_recipients": null, 
     "view_content_link": null, 
     "bcc_address": "[email protected]", 
     "tracking_domain": null, 
     "signing_domain": null, 
     "return_path_domain": null, 
     "merge": true, 
     "global_merge_vars": [ 
      { 
       "name": "merge1", 
       "content": "merge1 content" 
      } 
     ], 
     "merge_vars": [ 
      { 
       "rcpt": "[email protected]", 
       "vars": [ 
        { 
         "name": "merge2", 
         "content": "merge2 content" 
        } 
       ] 
      } 
     ], 
     "tags": [ 
      "password-resets" 
     ], 
     "subaccount": "customer-123", 
     "google_analytics_domains": [ 
      "example.com" 
     ], 
     "google_analytics_campaign": "[email protected]", 
     "metadata": { 
      "website": "www.example.com" 
     }, 
     "recipient_metadata": [ 
      { 
       "rcpt": "[email protected]", 
       "values": { 
        "user_id": 123456 
       } 
      } 
     ], 
     "attachments": [ 
      { 
       "type": "text/plain", 
       "name": "myfile.txt", 
       "content": "ZXhhbXBsZSBmaWxl" 
      } 
     ], 
     "images": [ 
      { 
       "type": "image/png", 
       "name": "IMAGECID", 
       "content": "ZXhhbXBsZSBmaWxl" 
      } 
     ] 
    }, 
    "async": false, 
    "ip_pool": "Main Pool", 
    "send_at": "example send_at" 
} 

내가 저지를 사용하여 HTTP 포스트를 보내는 다른 질문을 보았고, 내가 찾을 수있는 모든에만 위의 같은 key\value 매개 변수로 쌍되지 복잡한 문자열 유형을 보낼 수있는 방법이었다.

답변

0

JAXB를 보면 "객체"에서 "복잡한 매개 변수"를 "자동으로"빌드 할 수 있습니다. 기본적으로 프로 시저는 REST API 리소스가 허용하는 요청 메시지로 표시하는 데이터 구조를 나타내는 클래스를 정의한 다음 POST에 보낼 데이터로 채우고 보내면됩니다. 이 질문에서 정확하게 수행하는 방법에 대한 자세한 내용을 찾을 수 있습니다. Can jersey clients POST a JAXB object to the server using JSON?

+0

이 정보가 도움이 되었습니까? – emgsilva