1 Reply Latest reply on Nov 8, 2019 7:16 AM by JoAnn Kulcyk

    Calling TDM RESTAPI from Python

    JoAnn Kulcyk New Member

      Is anyone using python requests.post to GENERATE a plan using the TDM RESTAPI?   We are able to do it using curl, but we are getting a status code 500 when we use python.

       

      We create the curl command using Swagger:

       

      CURL

       

      curl -X POST "https://gn1dmxengprd03.gnet.biz:6643/api/public/tdm/v1/jobs"
      -H "accept: application/json" -H "authorization: Basic
      pw" -H "Content-Type:
      multipart/form-data" -F "type=Generate" -F

      "projectId=4020" -F
      "planId=11063"

       

      We use what we believe to be the equivalent python code:

       

      PYTHON

       

      import requests

      headers = {      
      'accept': 'application/json',
            
      'authorization': 'Basic pw',
            
      'Content-Type': 'multipart/form-data'

          }

      datavalues={      
      'type': "Generate",
            
      'projectId': 4020,
            
      'planId': 11063,
            
      'integrationServiceName':
      'INFA_PCIS_PRD',        

              }

      url='https://gn1dmxengprd03.gnet.biz:6643/api/public/tdm/v1/jobs'

      r = requests.post(url,
      json=datavalues, headers=headers, verify=False)

      print(r.status_code)

       

      and status_code is 500.

        This content has been marked as final.  Show 1 reply