Add comments via REST I am using waterwheel-swift to connect my iOS app to Drupal 8. Logging-in and node posting/editing work great, but when I try to post a comment, I get a 400 error. 

I am using the following code.

    let body = [
        "entity_type": [
            [
                "value": "node"
            ]
        ],
        "entity_id": [
            [
                "target_id": self.nodeID
            ]
        ],
        "field_name": [
            [
                "value": "field_x"
            ]
        ],
        "comment_body": [
            [
                "value": "How are you?"
            ]
        ]
    ]

    waterwheel.entityPost(entityType: .Comment, params: body as paramType) { (success, response, json, error) in
        if (success) {
            print(response)
        } else {
            print(error)
        }
    }


I get the following error: 


  Error Domain=Alamofire.AFError Code=3 "Response status code was unacceptable: 400."


rest.resource.entity.comment config is the following.

  langcode: en
  status: true
  dependencies:
    module:
      - basic_auth
      - comment
      - csv_serialization
      - hal
      - serialization
      - user
  id: entity.comment
  plugin_id: 'entity:comment'
  granularity: method
  configuration:
    GET:
      supported_formats:
        - csv
        - hal_json
        - json
        - xml
      supported_auth:
        - basic_auth
        - cookie
    POST:
      supported_formats:
        - csv
        - hal_json
        - json
        - xml
      supported_auth:
        - basic_auth
        - cookie
    DELETE:
      supported_formats:
        - csv
        - hal_json
        - json
        - xml
      supported_auth:
        - basic_auth
        - cookie
    PATCH:
      supported_formats:
        - csv
        - hal_json
        - json
        - xml
      supported_auth:
        - basic_auth
        - cookie


Please point out if something is wrong with my code.
Got it resolved, the problem was, i was not passing the parameter comment type. Made the following changes to body parameter and it now works. 

let body = [
        "entity_type": [
            [
                "value": "node"
            ]
        ],
        "entity_id": [
            [
                "target_id": self.nodeID
            ]
        ],
        "field_name": [
            [
                "value": "comment_x",  // Machine name of the field on the node
                "format": "no_html"
            ]
        ],
        "comment_body": [
            [
                "value": "How are you?"
            ]
        ],
        "comment_type": [
            [
                "target_id": "comment_x"  // Machine name of the comment bundle 
            ]
        ],
        "uid": [
            [
                "target_id": self.UID
            ]
        ],
    ]