Using Project Access Token¶
Warning
The current page still doesn't have a translation for this language.
But you can help translating it: Contributing.
In this guide, we'll explore how to interact with DATAMIMIC projects programmatically using project access tokens. This approach allows you to manage your projects and generate data through API calls, which is particularly useful for automation and CI/CD pipelines.
Prerequisites¶
- A DATAMIMIC project
- curl installed on your system
- jq installed on your system (for JSON processing)
base64
command-line utility
Getting Started¶
- Clone the Demo Basic JSON from the DATAMIMIC Demo Store.
- Add a new project access token for this newly clone demo project.
- Note down both the Project ID and the newly Project Access Token.
Basic Operations¶
Reading Project Files¶
To read the content of a file (e.g., datamimic.xml
) and save it to a local file also call datamimic.xml
:
1 2 3 4 5 |
|
Updating Project Files¶
Make any change you want to the file content locally then update it to the system.
To update a file's content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Generating Data¶
To trigger data generation:
1 2 3 4 |
|
This call will return a Task ID that you can use to track the generation progress and download artifacts.
Downloading Generated Data¶
To download and view generated artifacts:
1 2 3 |
|
Example Workflow¶
Here's a complete example of a typical workflow:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
Note
Replace your-datamimic-instance
, {project-id}
, {task-id}
and {your-access-token}
with your actual values in all examples.
Recap¶
In this guide, we explored how to programmatically interact with DATAMIMIC projects using project access tokens. Here's a summary of the key concepts and operations:
-
Setup and Authentication:
- Created/used a DATAMIMIC project
- Generated a project access token
- Used the token for API authentication
-
Basic Operations:
- Reading project files using GET requests
- Updating file content using POST requests
- Triggering data generation
- Downloading and viewing generated artifacts
-
Workflow Integration:
- Learned how to combine operations into a complete workflow
- Used environment variables for configuration
- Implemented basic automation patterns
These API operations enable you to automate DATAMIMIC project management and integrate it into your development workflows, CI/CD pipelines, or custom applications.