When updating a service via API PUT method, the "value" to be updated becomes null

Issue #9414 resolved
Adrien Vaschalde
created an issue

When I update a service (hook here) remotely using your API: r = requests.put(url, data = data, auth = auth)

Data being: type=POST&URL=https%3A%2F%2F4062ecfc-ngrok-com-48trlhsnt04o%2Erunscope%2Enet%2Fintake%2Fwebhook%2Fbitbucket%3Fapi_key%3Dapikey_2

The response I get is: r = {"id": 2874020, "service": {"fields": [{"name": "URL", "value": ""}], "type": "POST"}}"

--> Why is teh value not being updated please? If it's a bug to be fixed on your side, I will be forced to make DELETE + CREATE instead. If not, could you please indicate what I should do better?

Thanks a lot for your help, Adrien

Comments (5)

  1. Michael Frauenholtz staff

    Hi Adrien,

    This is working for me right now, but I'm also not sure what's wrong with what you're sending. Can you try 2 things for me to see if they work?

    1. Remove the type from the data. When you pass the service id to the PUT request, we already know what type it is
    2. Can you try any other URL just to see if it works? Try something simple like http://google.com

    Give those suggestions a try and let me know if that works for you. Thanks!

  2. Michael Frauenholtz staff

    Hi Adrien,

    I tried this again, and it's still working for me:

    ❯ curl https://bitbucket.org/api/1.0/repositories/mafrauen/loudmouth/services/2878767 -u mafrauen -X PUT -d URL=https%3A%2F%2F4062ecfc-ngrok-com-48trlhsnt04o%2Erunscope%2Enet%2Fintake%2Fwebhook%2Fbitbucket%3Fapi_key%3Dapikey_2
    Enter host password for user 'mafrauen':
    {"id": 2878767, "service": {"fields": [{"name": "URL", "value": "https://4062ecfc-ngrok-com-48trlhsnt04o.runscope.net/intake/webhook/bitbucket?api_key=apikey_2"}], "type": "POST"}}

    It seems like the data is not being passed correctly using your method. Can you try changing the value using curl like I have above to make sure that works correctly?

  3. Log in to comment