Hello,
I'm using http REST API for creating a new issue inside my JSM space.
When I'm sending the following curl command it works:
curl --request POST --url 'https://my-domain.atlassian.net/rest/api/3/issue/' --user 'my-email:my-token' --header 'Accept: application/json' --header 'Content-Type: application/json' --data '{ "fields": { "project": { "id": "10001"} ,"issuetype": {"id": "10005" },"summary": "new test","description": {"version": 1,"type": "doc","content": [{ "type": "paragraph","content": [{"type": "text","text": "this is the description test"}]}]},"assignee": {"id": "712020:ca397ef3-d08a-4a36-9bf0-6bd230252ef6"},"reporter": {"id": "712020:ca397ef3-d08a-4a36-9bf0-6bd230252ef6"}}}'
But when I'm trying to send it from my flutter app (FlutterFlow) it fails.
I'm using it in the following way
body: jsonEncode(
<String, Object>{
"fields": {
"project": {"id": "10001"},
"issuetype": {"id": "10005"},
"summary": "hello from flutterflow",
"description": {
"version": 1,
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "hello from flutterflow -- description"
}]}]},
"assignee": {"id": "712020:ca397ef3-d08a-4a36-9bf0-6bd230252ef6"},
"reporter": {"id": "712020:ca397ef3-d08a-4a36-9bf0-6bd230252ef6"}
}},),);}
My main problem is how to present the --user "email:token" being used inside the curl command in my app. Should it be inside the header option? ('authorization':'Basic ${base64(email:token)}) ? Should it be inside the body as a new line before the fields?
Actually I've tried all options and failed with all. The error message I keep receiving is:
Access to XMLHttpRequest at 'https://my-domain.atlassian.net/rest/api/3/issue/' from origin 'https://ff-debug-service-frontend-pro-ygxkweukma-uc.a.run.app' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
*I'm also tried using the atlassian flutter code inside pub.dev (https://pub.dev/packages/atlassian_apis) but it also didnt work.
Thanks,
Yuval