2016-05-03 15 views
-1

Ich versuche, ein Problem mit dem JIRA-API zu erstellen, ich versuche, dies mit curl POST:Fehler bekommen, während Ausgabe der Erstellung mit JIRA REST API

curl -D- -u username:password -X POST --data filename.txt -H "Content-Type: application/json" https://<JIRA_BASEURL>/rest/api/2/issue/ 

mit diesen Daten in filename.txt:

{ 
"fields": { 
    "project": 
    { 
     "key": "PROJECT-key" 
    }, 
    "summary": "REST EXAMPLE", 
    "description": "Creating an issue via REST API", 
    "issuetype": { 
     "name": "Bug" 
    } 
    } 
} 

Und ich erhalte eine Fehlermeldung, dass ich nicht in der Lage bin zu verstehen

HTTP/1.1 400 Bad Request 
Server: nginx 
Date: Tue, 03 May 2016 09:57:03 GMT 
Content-Type: application/json;charset=UTF-8 
Transfer-Encoding: chunked 
Connection: keep-alive 
X-AREQUESTID: 174x4470x1 
X-ASEN: SEN-34722393 
X-Seraph-LoginReason: OUT 
X-Seraph-LoginReason: OK 
X-ASESSIONID: jhs5ewrt4bh 
X-AUSERNAME: username 
X-ATENANT-ID: jira.atlassian.net 
Cache-Control: no-cache, no-store, no-transform 
X-Content-Type-Options: nosniff 
Set-Cookie: JSESSIONID=41A2A4ABC78BDABCA7B13FB45E3; Path=/; Secure; HttpOnly 
Set-Cookie: studio.crowd.tokenkey=""; Domain=.jira.atlassian.net; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly 
Set-Cookie: studio.crowd.tokenkey=65IUtfdCjefQ8UlVlh00; Domain=.jira.atlassian.net; Path=/; Secure; HttpOnly 
Set-Cookie: atlassian.xsrf.token=BLSG-CYWX-OPRE-Y0WF|e3453a213679767e6370dt637e97f58|lin; Path=/; Secure 

{"errorMessages":["Unrecognized token 'fieaett': was expecting 'null', 'true', 'false' or NaN\n at [Source: [email protected]; line: 1, column: 26]"]} 

kann mir jemand durch diesen bitte helfen?

Antwort

0

ich es herausgefunden:

Befehl

curl -D- -u username:password -X POST --data-binary "@filename.txt" -H "Content-Type: application/json" https://<JIRA_BASEURL>/rest/api/2/issue/ 

filename.txt:

{ 
    "fields": { 
     "project": 
     { 
      "key": "TEST" 
     }, 
     "summary": "REST ye merry.", 
     "description": "Creating of an issue using project keys and issue type names using the REST API", 
     "issuetype": { 
      "name": "Bug" 
     } 
    } 
} 

Das funktioniert :)