Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

curl is not working in confluence calender

Mrinmay_Biswas May 4, 2020

I have python script is is working using python request and response but same  body and credential is not working in groovy with curl command. It is sowing null event pointer while trying to update calendar using event.json

 

Python scripts which is working- 

 

import requests
import json
baseURL = 'https://confluence.mycomp.com/rest/calendar-services/1.0/calendar/events.json'
headers = { "content-type" : "application/x-www-form-urlencoded" }
user='****'
password='****'
hd={'Content-Type': 'application/json'}
calenderData = {"subCalendarId":"7ed3840a-6e3e-4043-a4da-be02a8208eaf","eventType":"Events", "what":"CTEF1 Test Deployment", "person": ["2c9fad3f6764e43f0167788e66a9004e"],"startDate":"28-Apr-2020","endDate": "28-Apr-2020","allDayEvent": "true","where": "By DVM PipeLine" }
response = requests.put(baseURL, headers=headers, auth=(user, password), data=calenderData, timeout=15)#curl -u s-osj_jira-u-itsehbg:wnesIl16 --data datac -H "Content-Type: application/json" -X PUT https://confluence.build.ingka.ikea.com/rest/calendar-services/1.0/calendar/events.json
print('\n\n\n')
print(response.content)

 

Groovy curls which is not working :-

baseURL = 'https://confluence.mycomp.com/rest/calendar-services/1.0/calendar/events.json'

user='****'
password='****'

calenderData = {"subCalendarId":"7ed3840a-6e3e-4043-a4da-be02a8208eaf","eventType":"Events", "what":"CTEF1 Test Deployment", "person": ["2c9fad3f6764e43f0167788e66a9004e"],"startDate":"28-Apr-2020","endDate": "28-Apr-2020","allDayEvent": "true","where": "By DVM PipeLine" }

def response = ["curl", "-k", "-u", "user:passwords", "-X", "PUT", "-d", "${calenderData}", "-H", "Content-Type:application/json", "${baseURL}"].execute().text

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events