I am currently trying to use an API Request step in a Zap to update a field on Chargebee; they don’t take JSON requests so I’m trying to change it into x-www-form-urlencoded. The response data seems like it was a successful request, but the field that I’m trying to update is not changing at all.
After using the sample CURL and changing it a bit to fit what I needed, it worked well when it was in x-www-form-urlencoded format, but Chargebee doesn’t take JSON which is the primary thing Zapier uses :(
(I got confirmation from our Chargebee contact that they don’t use JSON for requests, only for the response body)
Hi @Troy Tessalone,
Just wanted to provide more context as well, I did try to use the existing Update a Subscription step, but it asks for other required fields that I don’t want to touch. It asks for Item Family and Item but I don’t want to add/delete/overwrite the information that’s already in there. I tried to use a Retrieve Subscription step before the Update step to try and grab this information to keep it the same, but it’s not even information that’s coming in the response. So that’s why I thought it would be better to use an API request to update the one field, but it’s proving to be difficult as well
Chargebee provides an HTTP-based API that follows the principles of REST. The HTTP rules followed allow simple HTTP clients like cURL to be used as well. The URLs are resource-oriented, the request format is form-encoded, and the responses are in JSON.
We would need to see full screenshots with how the Zap step is configure for the Chargebee API. (e.g. method, url, headers)
@Troy Tessalone
Sure!
@MichelleT
Have you tried reaching out to Chargebee Support for help with their API?
NOTE: Remove the trailing /
Custom Fields
Purchase API supports custom fields of Subscriptions, use the following format to specify custom fields in Purchase API: subscription_infoncustom_field].
Try setting the Content-Type to application/json OR removing the additional Header for Content-Type.
@Troy Tessalone
I have reached out to the Chargebee team, they’re the ones that confirmed that Chargebee doesn’t support JSON so I can’t change the Content Type and expect it to work. Since the issue is formatting the request in Zapier, not sure how else they could help me.
subscription_infoicustom_field]This is for the Purchase API, I’m not currently working with Purchases, just the Subscriptions.
@MichelleT
Did Chargebee Support tell you to use that Content-Type? (Or where in their API docs do you see that Content-Type specified?)
On the Subscriptions endpoints, I don’t see reference to Custom Fields.
Can you screenshot/link to that info?
@Troy Tessalone
This is what I see in the API documentation for Subscriptions; I realize that it shows me the Custom fields we have in our instance of the site because currently I’m logged in (You can also see what formats are supported for the API requests at the top, and the custom field I want to update at the bottom)
@MichelleT
What about this?
Did Chargebee Support tell you to use that Content-Type? (Or where in their API docs do you see that Content-Type specified?)
@Troy Tessalone
They didn’t tell me to use that Content Type specifically, they just confirmed they don’t support JSON. So I assumed x-www-form-urlencoded was the next best thing since the CURL requests in Postman turned into it when I was testing. But I’m more than willing to switch to anything else that would work, it doesn’t need to be this current format if it’s not the best solution.
@MichelleT
Try without the Content-Type Header as it may not be required.
Try with the Content-Type Header set to application/json since the data being sent is in JSON format.
@Troy Tessalone
I’ve already tried both suggestions and it’s all the same, the field is not being changed.
I know that the body looks like JSON, I just don’t know how to write it in the Key and Value format that Postman was doing it in.
@MichelleT
If it works in Postman, then post screenshots with how the request was configured along with the logs of the processed request.
@Troy Tessalone
This is what the successful API request looks like on Postman in case you were curious and/or it helps in this case:
@Troy Tessalone
Oh ok! I sent that screenshot before that previous reply, I’ll add the other screenshots you’ve asked for!
@MichelleT
Can you show the Headers?
@Troy Tessalone
The relevant headers, at least in my opinion, are in that second screenshot but I can send one of all of them sure:
In case you think of the same thing as me, it’s not “failing” because of Authorization issues because the JSON in response on Zapier still claims that the request was successful. It just doesn’t actually make the change it’s supposed to.
Hi, i am having the same problem with Twilio API, they expect an urlencoded POST, POstman works ok but not in Zapier, it always send the request with JSON Body instead of a form data.
@andresamayadiaz I don’t know if this is related to your issue, but the way that I was able to fix this was by putting the “key” and “value” into the Query String Parameter part instead of the Body