Coda API - Edit permissions metadata

I am building an automated transaction flow whereby:

  1. User pays for access to my published Doc with Stripe
  2. Stripe checkout event triggers an action in Coda
  3. Coda action triggers a pack formula that:
    a) Creates a copy of the source Doc for my user, using the Doc id that was sent through the checkout
    b) Places the copied Doc in my “Customer Docs” folder
    c) Adds a share permission to the new Doc, giving the customer edit access

This all works fine, I haven’t implemented the last step yet, but I’ve realised there is something missing.

There is a permissions metadata object I need to update, which is available as a GET request from the api. These are the properties that are set by default on my copied Doc when it gets created:

	"canShare": true,
	"canShareWithOrg": false,
	"canCopy": true

There is no API documentation for a similar request to PUT or POST a change to these parameters. I tried to do it anyway but received a 404 error.

I need to be able to make all of these properties false, otherwise it breaks my idea - my customer will be able to copy the Doc to their own account and share with whoever they want, unless I manually go in and change the settings every time a new Doc is created. I do not want to have to do that because it’s tiresome, and I want to stay away from my user’s document as what they put in there is none of my business.

Either I need an API request to update these properties or I need to somehow change the default settings that are applied when the Doc is created. Is there any way to do this?

Never mind!

I implemented the final step, logged in as a customer and I’m happy to see that the user cannot copy or share the doc, and they aren’t able to access or change these parameters from the share menu. So the default behaviour is exactly what I want.

I was confused for a second there but it turns out the default behaviour is perfect :+1:

1 Like

Great! I’ve actually implemented the exact same flow with the Coda School!

We launched in beta and it’s working wonderfully. Stripe payments, custom pack to copy docs, share, etc. let me know if you need any help down the road - no need to reinvent the wheel.

1 Like

I’ve actually double checked this just now and I was wrong - a new user can in fact create a copy of their shared document to their own workspace by default.

Simply put:

The copy I create for my customer does not inherit the sharing metadata options I have set on the source doc.

This is a bummer.

I can still achieve what I want manually however. Instead of having one button that kicks off all the necessary actions in sequence, the process will be:

  • Receive a notification of a new subscription
  • Go to my admin area, click a button on the new Customer to create them a copy
  • Manually go into their doc and change the setting. It is now safe to share
  • Go back to my admin area and click a button to share with the customer.

This is ok I guess. But it doesn’t scale and is prone to me making a mistake.

Also, if a customer from another time zone signs up and I’m asleep, they might be waiting for a while to get access!

It would be nice if the whole process could be 100% self-serve. But doesn’t appear to be technically possible with the public API right now.

As an aside, the values returned from the GetMetadata endpoint are unique to the person calling the API - So I can’t just have a formula that returns that user’s access level (at least, not with regard to their ability to copy the document).

I will have to manually go and check the document to get the status. So I will need to also keep a record of which documents I have changed the settings on. Not exactly ideal

But, we will live with it! :slight_smile:

1 Like

This doc from @Vinny_Green1 provides a solution to sell docs with Shopify.

Shopify markets to small businesses.

1 Like

FYI, there is a new updateAclSettings endpoint in the API that should allow you to change these settings on the copies:

I hope this helps!

1 Like

Theres also a button in the doc explorer pack that lets you edit these permissions!

No need to write any code!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.