Jump to content
  • 0

Darshan Hiranandani : How do I update an existing file in Caspio using the REST API?


darshanhiranandani

Question

Hi 

I hope you're doing well!

I need to update an existing file in Caspio using the REST API, but I'm a bit unsure about the process. Could you please help me with the steps or point me in the right direction?

Specifically, I'm looking for guidance on:

  1. The correct endpoint to use for updating a file.
  2. The required parameters or data format for the update request.
  3. Any specific headers or authentication needed for the API call.

If you have any examples or documentation that could assist, that would be greatly appreciated!

Thanks a lot for your help!

Best,
Darshan Hiranandani

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hello there! Caspio releases a new feature called "integrations"! Refer below: 

Caspio Extensions is a new plug-and-play capability that connects your Caspio account to third-party services, enabling various functionalities. We are very excited about the roadmap of Extensions and in future releases, we will open it up for our partners and even customers to create their extensions.

Source: https://howto.caspio.com/release-notes/caspio-52-0/#:~:text=Introducing Caspio Extensions

Link to comment
Share on other sites

  • 0

Hello @darshanhiranandani,

Please note that Swagger UI is a kind of Caspio REST API documentation and you can always check available methods and additional details there  

https://howto.caspio.com/integration/web-services-api/swagger-ui/

 

1) The endpoint to update a file is:

Method: PUT

Request URL:  https://accountID.caspio.com/rest/v2/files
OR                        https://accountID.caspio.com/rest/v2/files?externalKey={folder_external_key}

This is information from Swagger UI:

3Qk5N6H.png

So, for example, if the file is stored in the root folder, please use this request URL https://accountID.caspio.com/rest/v2/files

If the file is stored in some Folder, you need to know the external key of that Folder. For that please use another request. It is a GET request.

Then the request URL should be https://accountID.caspio.com/rest/v2/files?externalKey={folder_external_key}

OEhFPcI.png

 

2) Parameters are needed if the file is stored in the folder
For example:

https://accountIDcaspio.com/rest/v2/files?externalKey=8c600532-f165-434c-9bd2-e8aa02f5481a

Here 8c600532-f165-434c-9bd2-e8aa02f5481a is the external key of the Folder.

3) Headers.

Each request should include an Authentication Header. This article explains how to get the access token:

https://howto.caspio.com/integration/web-services-api/authenticating-rest/ 

Every request have to include the following header parameter:

Parameter name:  Authorization
Parameter value: Bearer <access token value>

You must replace <access token value> with your access token.

The second important Header is Content-Type. Its value should be multipart/form-data.

Link to comment
Share on other sites

  • 0

Let me provide an example of updating the File via Postman. 

1) For example, I want to update the file named 'user' stored in the Icons folder
XC4bMVG.png

2) First, I need to get the external key of this folder.

So, I send a GET request, and from the request I receive the external key = 8c600532-f165-434c-9bd2-e8aa02f5481a

CIZFXg7.png

 

3) The next step is to update the file.

Please note that if the file is attached to some record it should be updated with the field that has the same name and extension.

If the file has a different name or/and extension, it will be added as a new file and then it should be attached to the record manually (in the Table directly or via the DataPage).

97JvYto.png

 

aOk2cBb.png

 

yQTDyzH.png

 

5TdsODm.png

 

Result:

JiQskj0.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...