Project

General

Profile

Script to import issues via REST API in private project

Added by Victor Sergienko over 6 years ago

I'm trying to create an issue via POST request to hostedredmine.com API in Python 3 like:

url = "https://www.hostedredmine.com/issues.json" 
key = "***" 

def createIssue(body):
    body = {'issue': body}
    data = urllib.parse.urlencode({'issue': body})
    data = data.encode('utf-8')
    request = urllib.request.Request(url)

    # adding charset parameter to the Content-Type header.
    request.add_header("Content-Type", "application/json")
    request.add_header("X-Redmine-API-Key", key)
    #request.add_header("Content-Length", len(data))

    f = urllib.request.urlopen(request, data)
    print(f.read().decode('utf-8'))

createIssue({
    'project_id': 'plando',
    'subject': 'test1',
    'notes': 'tetest',
     #'parent_issue_id': '215453',
    }
)

and getting a HTTP Error 500: Internal Server Error.

I've tried various URLs, with and without .json suffix or my project path.

Does anybody have any idea, what could it be?


Replies (129)

RE: Script to import issues via REST API in private project - Added by iso9001 pro 19 days ago

Great tips as always . a quick browser of my past blogs and i can see numerous examples where i should have implemented the steps you describe . i'm getting better, but still have room for improvement. keep sharing.

iso consulting[[http://vedadate.com/member/blog_post_view.php?postId=49908]]

9001 iso[[https://friendster.io/read-blog/2081 ]]

iso provider[[https://lyfepal.com/blogs/2759/All-You-Need-To-know-About-ISO-Certification-in-Saudi ]]

iso saudi arabia[[https://facecjoc.com/read-blog/141]]

iso consultant[[https://fnetchat.com/read-blog/406]]

RE: Script to import issues via REST API in private project - Added by Mike Alby 18 days ago

Thank you for this informative post.

RE: Script to import issues via REST API in private project - Added by Mike Alby 18 days ago

Thank you for this informative post. Chrck my site if you have a chance. http://netip-ny.org

(126-129/129)