title: How to set Affects Version field via JIRA REST API - PHP
body: <p>I would like to update the affects versions field via JIRA REST API. But I'm getting an error:</p>
  
  <blockquote>
    <p>{"errorMessages":[],"errors":{"versions":"Affects Version/s is required."}}</p>
  </blockquote>
  
  <p>I have the following code:</p>
  
  <pre><code>public function requestBug($summary, $components, $affectsVersions, $fixVersions, $assignee, $environment, $description)
  {
      $json = Array ( "fields" =&gt; Array (
                                          "project" =&gt; Array( "id" =&gt; 10051),
                                          "summary" =&gt; $summary,
                                          "issuetype" =&gt; Array ( "name" =&gt; "Bug" ),
                                          "components" =&gt;Array(0 =&gt; Array("id" =&gt; $components)),
                                          "versions" =&gt;Array(0 =&gt;Array("affectsVersion" =&gt; $affectsVersions)),
                                          "versions" =&gt;Array(0 =&gt;Array("fixVersion" =&gt;$fixVersions)),
                                          "assignee" =&gt; Array("name" =&gt; "$assignee"), 
                                          "environment" =&gt; "$environment", 
                                          "description" =&gt;$description
                                        )
                   );
  
      return $json;
  }
  </code></pre>
  
  <p>Please assist. I came across <a href="https://answers.atlassian.com/questions/25142615/how-do-i-set-affects-versions-using-rest-api" rel="nofollow">this</a> link, but doesnt work for me</p>