{“errorMessages”:["Unexpected character (''' (code 39)): expected a valid value

后端 未结 4 2072
眼角桃花
眼角桃花 2021-02-07 09:32

I found \"Query using POST\" from here.

And tried to use curl command from command like. Installed curl by refering this for windows.

Here is my CURL string:

相关标签:
4条回答
  • 2021-02-07 09:41

    Seems to be an windows issue. Do not use the ' (single-quote) character.

    Instead, use " (double-quote) character for enclosing the string. Then, if you have inner quotes, use """ (3x double-quotes) to escape them.

    Example: "{ """name""":"""Frodo""", """age""":123 }"

    0 讨论(0)
  • 2021-02-07 09:41

    Try this. It should work.

    curl -D- -u admin:password -X POST -H "Content-Type: application/json" --data 
    \\"{"jql":"project = CI","startAt":0,"maxResults":50,"fields":["summary","status","assignee"]}\\"
    "https://myclientname.atlassian.net/rest/api/2/search"
    

    Don't forget to use a slash (\*{}\*}after and before json

    0 讨论(0)
  • 2021-02-07 09:49

    I tried the cURL you pointed to in your question, but with no luck. Also, the cURL comes with Git is not working either. However, the one I installed with CygWin works. And the same command is also working in Ubuntu. Which basically indicates that your command itself is OK.

    If you are working on Windows, I recommend you to use a tool called Fiddler. It can perform almost all HTTP requests you may need. Good luck!

    Update: Here I add the steps to make HTTP POST request with Fiddler.

    1) After starting Fiddler, you will see the GUI like Figure 1. The upper right panel is where you should input staff like JIRA's website, request type, and the content you want to post. To be specific, under the "Composer" tab, you need to select "POST" as your request type, and put the JIRA's URL there, keep HTTP/1.1 selected. You should put the request header under the URL bar. Now, you need to pay attention to. At least, you should input two things in HTTP header: the content type, which is "application/json", and the authorization header. The authentication is a Base64 string, you can get your Base64 string here with your "admin:password". If you want to know more about the basic authentication method, please refer Jira's website here. The lower right panel of the GUI is where you should put your post content. enter image description here

    2) When you get these staff ready, you can click the "Execute" button at upper right corner of the GUI. The execution result will be shown at the left panel. As Figure 2 shows, if you get a result with the status 200, congratulations, you got it. If you get other types of results, please google the error code or leave comments here. enter image description here

    3) Double click the result, the returned JSON content will be shown in the lower right panel like Figure 3. You can try different tab to see the returned staff. For example, if you go to the "TextView", you will get the returned JSON as pure string. enter image description here

    Please comment if you have any further question.

    0 讨论(0)
  • 2021-02-07 09:57

    Pls verify if you have any value wrapped with single quote.

    e.g

    "NetworkType": 'Test'
    
    0 讨论(0)
提交回复
热议问题