Arcweave offers an API that you can use to generate exports for their projects.
Currently the API is read only, but we plan to extend it with modify and action capabilities. For the time being, we provide JSON exports and exports for Godot Engine.
In this chapter we will showcase how to create an API Token and use it in your app to get the exports.
In order to use the API you will have to be in an Arcweave Team plan. To see and upgrate your plan, you can go to your account plan page.
In order to use the API, you will have to create an API Token.
Go to your account page using your account icon on the top right corner.
If you are on a Team Plan, an option to Generate API Token will show up.
When you click this, a new API Token will be generated to use it to retrieve your project exports. The Generate API Token option will change to Show API Token.
If you click the new option, a modal containing your API Token will show up, that you can copy.
{warning} This token gives access to all your project information! Be careful where you store and share it!
In case you want to generate a new API token and delete the old one, you can press the Generate New API Token button in the API Token modal.
The default headers to use the endpoint are the authorization header containing the API Token as a Bearer token and the Accept header with an application/json
value
Authorization: Bearer [API Token]
Accept: application/json
So to make a request using PHP for the JSON export of the project 4OlzRvblqP this would be:
$response = $client->request('GET', '/api/4OlzRvblqP/json', [
'headers' => [
'Authorization' => 'Bearer '.$token,
'Accept' => 'application/json',
],
]);
For now, we provide two endpoints, a JSON and a Godot Engine endpoint
Endpoint | Method | Headers |
---|---|---|
/api/{hash}/json |
GET | Default |
/api/{hash}/godot |
GET | Default |
The hash option in the endpoints, is the Project hash that we want to retrieve the information for. You can find it by looking at the URL of your project. The default URL format is:
arcweave.com/app/project/[hash]?board=[board-id]&scale=1&coords=[x],[v]
So i.e. for the Project URL
https://arcweave.com/app/project/4OlzRvblqP?board=630fdb8a-48d6-473e-9974-2460f7eb2b41&scale=0.466508&coords=-9919.42,-9879.4
The Project Hash is 4OlzRvblqP
, so our endpoints would be /api/4OlzRvblqP/json
and /api/4OlzRvblqP/godot
.
The JSON endpoint will respond with the JSON of the project, similar to a JSON Export.
{success} Success Response
Code 200
{
"startingElement": "38375689-9e4d-430e-954c-65205eb622fe",
"boards": {
"2ad15ff6-f2ba-4f1d-9d9d-68938c683d7e": {
"name": "Root",
"root": true,
"children": [
"630fdb8a-48d6-473e-9974-2460f7eb2b41",
"733b1cc4-6d51-4ad6-9fba-444b4f2d98f3"
]
},
"630fdb8a-48d6-473e-9974-2460f7eb2b41": {
"name": "Main Board",
"notes": [
"eda3ed5a-bdd5-4981-a72f-c7847630310a",
"585c89a5-a16c-44db-9346-6e2725afcd88",
"5f45b936-1a0f-4834-87c3-579fb72329b1",
"0d580890-add4-4750-9b0c-64a9be4bd9be",
"045fcf7a-0e29-4f29-a6b3-f1be825832ed",
"27bcf38e-cef9-4413-b4c9-97e6c7300ec3",
"c917680a-9884-41fb-832c-7ac41f87c520"
],
[...]
}
{danger} Error Response
Code 500
There was an error during the export of the project.
Code 403
You have insufficient permissions for exporting this project. Please make sure you are still on a Team Account, you are using the correct Hash ID and you are an Owner/Editor of the project.
The Godot endpoint will respond with a JSON containing the two Godot Files as strings. This Endpoint is used by our Godot Plugin to update the resources of the project.
{success} Success Response
Code 200
{
"data": "[DATA EXPORT FILE CONTENTS]",
"state": "[STATE EXPORT FILE CONTENTS]"
}
{danger} Error Response
Code 500
There was an error during the export of the project.
Code 403
You have insufficient permissions for exporting this project. Please make sure you are still on a Team Account, you are using the correct Hash ID and you are an Owner/Editor of the project.