Data Source - Upload new File
The Data Source endpoint allows you to upload a new file as data source (type file
) by POST
request via the API. This can be useful, for example, if you want to regularly update your data source with an updated data file in an automated way. The file must be formatted either in JSON, XML, or CSV format and must be sent as form-data
. (See. https://apidog.com/articles/what-is-form-data-content-type/)
The general format of the API endpoints is:
{YOURBASEURL}/api/custom/DataSource/ChangeFile/{DATASOURCEID}
Variable Parameters
Base URL
Depending on your data residency settings, you may need to look up {YOURBASEURL}
to create the endpoint URL. You’ll find the BaseUrl under Settings > Custom External REST API tab above the User ID.

Data Source ID
To update an existing data source via API, you need the {DATASOURCEID}
of the target data source that is to be replaced by the new file. You will find this ID at the very top of the Data Source Configuration screen (Data Source tab).

Limitations:
a maximum of 1 request per minute
a maximum of 100 requests per 24 hours
will not invalidate already cached versions. This can be worked around by decreasing the
cache minutes
value.
Example Curl Request
curl -X POST \
'https://external-data-for-jira.codefortynine.com/api/custom/DataSource/ChangeFile/{DATASOURCEID}' \
-u 'username:password' \
--form 'file=@/path/to/file/datasource_data.json'
Example Postman
URL
Method POST
with generated URL:

Authorization
Basic Auth with username & password:

Body
The type of the parameter has to be set to File
.

Example Google Sheet Apps Script
If a data source should be regularly updated from a Google Sheet, you can add an App Script to the sheet by going to Extensions and clicking Apps Script.

You can find more on these App Scripts in Google’s documentation.
When the Apps Script Project is created, you can use the following code in your Code.gs
file:
The main script retrieves important variables from script properties, which you can set in your Apps Script project under ⚙️ Project Settings > Script Properties. The following properties need to be created and set to the values of the variables described above and your authentication variables:
Property | Value |
---|---|
edUser | Your User ID |
edSecret | Your Secret |
edUrl | Your Base URL |
edSource | Your Data Source ID |
Then you need to create a trigger in the project to trigger the onOpen
function in the Code.gs
file when a User opens the sheet. This function will add the Custom Actions menu and its Send Sheet to Data Source option, which will trigger the main sendSheetToAPI
function.


Now you should be able to open the sheet and see the Custom Actions menu and its Send Sheet to Data Source option. You should also get a confirmation message if everything went as planned. Otherwise, you can check your logs in your Apps Script project under Executions.