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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,554,659
Community Members
 
Community Events
184
Community Groups

CURL is not working to update Confluence calender in groovy but same is workinh using python request

Edited

Calender event is getting update using python request and response but CURL can not able to do so using groovy

 

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)
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

1 answer

0 votes
Dave Chevell
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 08, 2020

Hey @Mrinmay_Biswas ,

I noticed in your python example, you set the variable hd={'Content-Type': 'application/json'} but hd is never actually used. Your PUT via requests uses headers = { "content-type" : "application/x-www-form-urlencoded" } from further up in the script - that is to say, you're setting the content-type header to application/x-www-form-urlencoded

Conversely, in your Groovy example you're setting the content-type header to application/json

Given that it works in Python, can you try updating your Groovy script to use the same content-type of application/x-www-form-urlencoded and see how you go?

Cheers!

Dave

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events