Capsule - API Module

I am trying to use the Capsule API module to change the owner on an opportunity. I keep getting error 400. I might know why but I dont know how to fix it. Capsule needs Content-Type = application/json. This is set up as a header in the module as default. But further down the module set up there is a Content-Type setting and you can only choose Text or Binary. This would seen to override the application/json setting. Hence the error 400 being returned.

How do I make sure Content-Type is set to application/json? Or any other help on getting my api to run. The Body of my json put command that I am using as a simple test to change the description is:
}
“opportunity”: {
“description”: “New Opportunity Name”
}
}

I don’t think it is because of the Content-Type : Text that is being used in the API module causing this error. It is more with how you are sending the data to CapusleCRM to update owner on an opportunity.

Can you share what your API URL looks like,

It should be something like this,

/v2/opportunities/{opportunityId},

Also for the JSON body that you are crafting not sure how it should look like, but reviewing the document for Capusle CRM, it might look something like this,

{
	"opportunity": {
		"name": "new opportunity name",
		"owner": {
			"id": 6
		}
	}
}

You can use this JSON directly on the Body section of Make an API call with Content Type - Text. Leave the header as it is to application/json for Content Type.

I am not entirely sure if that is the correct body to send to change the owner, Can you link me the Capusle CRM document for this specific task?

1 Like

My url looks like this
/v2/opportunities/{{30.id}}
The 30.id is mapped from a previous step in the scenario.

I have also looked at the capsule documentation and copied the body. The content I have shared is to change the description - which I am using as an easier test than changing the owner. Once this is working I will find the owner details.

But if I cant even change the description there is no hop of changing the owner!

Any ideas what is wrong?

It works for me, Can you crosscheck if you are using method as PUT ,

1 Like

Yes, I am using PUT

I think I will follow your lead and do a simple test first before trying to put it in my more complex scenario.

My settings look the same as yours!

2 Likes

Hmm, Seems weird then, Can you copy the body that you have and pass it here. Or, Just the screenshot of this particular module with Body in it.

I think the issue is with the Body Payload Formatting, So, I just want to check it and see if there is anything amiss.

1 Like

I also now have it working on a simple 2 step scenario. So at least I know that I am doing the correct thing.

I will now try and replicate that in my more complex scenario.

It is now working in my complex scenario.

I must have confused myself at some point!

Thank you for your help

Oh okay, Glad it worked out for you.

1 Like