cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper IV
Helper IV

Two actions using the same URL, or one action action (and URL) with two different request bodies

So Intuit built their QBO Customer API to use the same URL for two distinctly different actions: Create (POST) and Update (also, POST for some reason).

Create a customer

 

 

#Request URL
POST /v3/company/<realmID>/customer

Content type:application/json
Production Base URL:https://quickbooks.api.intuit.com
Sandbox Base URL:https://sandbox-quickbooks.api.intuit.com

#Request Body
{
  "FullyQualifiedName": "King Groceries", 
  "PrimaryEmailAddr": {
    "Address": "jdrew@myemail.com"
  }, 
  "DisplayName": "King's Groceries", 
  "Suffix": "Jr", 
  "Title": "Mr", 
  "MiddleName": "B", 
  "Notes": "Here are other details.", 
  "FamilyName": "King", 
  "PrimaryPhone": {
    "FreeFormNumber": "(555) 555-5555"
  }, 
  "CompanyName": "King Groceries", 
  "BillAddr": {
    "CountrySubDivisionCode": "CA", 
    "City": "Mountain View", 
    "PostalCode": "94042", 
    "Line1": "123 Main Street", 
    "Country": "USA"
  }, 
  "GivenName": "James"
}

 

 

Full update a customer

 

 

# Request URL
POST /v3/company/<realmID>/customer

Content type:application/json
Production Base URL:https://quickbooks.api.intuit.com
Sandbox Base URL:https://sandbox-quickbooks.api.intuit.com

# Request Body
{
  "domain": "QBO", 
  "PrimaryEmailAddr": {
    "Address": "Surf@Intuit.com"
  }, 
  "DisplayName": "Bill's Windsurf Shop", 
  "PreferredDeliveryMethod": "Print", 
  "GivenName": "Bill", 
  "FullyQualifiedName": "Bill's Windsurf Shop", 
  "BillWithParent": false, 
  "Job": false, 
  "BalanceWithJobs": 85.0, 
  "PrimaryPhone": {
    "FreeFormNumber": "(415) 444-6538"
  }, 
  "Active": true, 
  "MetaData": {
    "CreateTime": "2014-09-11T16:49:28-07:00", 
    "LastUpdatedTime": "2015-07-23T11:07:55-07:00"
  }, 
  "BillAddr": {
    "City": "Half Moon Bay", 
    "Line1": "12 Ocean Dr.", 
    "PostalCode": "94213", 
    "Lat": "37.4307072", 
    "Long": "-122.4295234", 
    "CountrySubDivisionCode": "CA", 
    "Id": "3"
  }, 
  "MiddleName": "Mac", 
  "Taxable": false, 
  "Balance": 85.0, 
  "SyncToken": "3", 
  "CompanyName": "Bill's Windsurf Shop", 
  "FamilyName": "Lucchini", 
  "PrintOnCheckName": "Bill's Wind Surf Shop", 
  "sparse": false, 
  "Id": "2"
}

 

 

Really, it looks like it determines if it is an update if the "Id" key is present in the body. That is the only distinction as to if it should update a record.

So, at any rate, I need a Create and an Update action. The Customer Connector will not allow this because they share the same URL.

What are my options here?

  • Make a separate custom connector? (That would be pretty stupid if I have to do this.)
  • Is there a way to force Power Automate to accept two Actions with the same URL? (I honestly don't see why this shouldn't be allowed. The action name being called should delineate the URL and Body to use. What difference does it make if it is the same URL.)
  • Is there a way to have two distinct bodies per one action in the custom connector?
  • Or, do I just have to build the body in the Flow with Compose and only have one generic action in the customer connector called "Create and Update Customers"?

Seems like the last option is going to be the case. If so, how do I add a request body from a Flow?

2 REPLIES 2
Microsoft
Microsoft

Hi,

 

Looking at both of your issues here, it seems like you have some kind of overall issue wit how you have your custom connector set up. I'm not certain exactly if there is something wrong with how you have it set up or if its a limitation with the connection itself. I would recommend creating a Microsoft Support request on this. I'll include a link below; on how to do so if you would like to go down that route. Otherwise if any communities members might know what the issue feel free to chime in.

 

If you would like to create a ticket with Microsoft Customer Support here is a link on how to do so: https://docs.microsoft.com/en-us/power-platform/admin/get-help-support

 

Regards,

 

Alex

 

-------

 

Community Support Team _ Alex Rezac
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ok, submitted a ticket. But my work around for the time being is in the custom connector, when I declare the request, I just have the body as:

{
}

That way, I can write out the request body in the flow. Kind of a hassle, but the issue as far as I can tell are two things:

  1. Swagger's design only supports one path + verb per their own own words
  2. Intuit just designed their API really poorly... seriously, an update should be a PUT or PATCH, not a POST and it shouldn't be left up to the request body to determine the action. The fact that the "Id" in the request body is what delineates that it is an update, should have been a good indicator that the URL should have been more RESTful like v3/company/<realmID>/customer/<Id> or at least a query parameter like ?Id=<Id>.

At any rate...

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (3,853)