POST
/api/v2/clients/{client_id}/projects/bulkImport project data (multiple projects, XML)
Code samples
# You can also use wget
curl -X POST /api/v2/clients/{client_id}/projects/bulk \
-H 'Content-Type: multipart/form-data' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
POST /api/v2/clients/{client_id}/projects/bulk HTTP/1.1
Content-Type: multipart/form-data
Accept: application/json
const inputBody = '{
"file": "string",
"notes": "Import on 2023-01-01"
}';
const headers = {
'Content-Type':'multipart/form-data',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('/api/v2/clients/{client_id}/projects/bulk',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'multipart/form-data',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post '/api/v2/clients/{client_id}/projects/bulk',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'multipart/form-data',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('/api/v2/clients/{client_id}/projects/bulk', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'multipart/form-data',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','/api/v2/clients/{client_id}/projects/bulk', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("/api/v2/clients/{client_id}/projects/bulk");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"multipart/form-data"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "/api/v2/clients/{client_id}/projects/bulk", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /api/v2/clients/{client_id}/projects/bulk
Imports XML files for multiple projects at once.
Body parameter
file: string
notes: Import on 2023-01-01
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| client_id | path | integer | true | Client ID |
| body | body | object | true | XML file with project information |
| » file | body | string(binary) | true | XML file (application/xml or text/xml) |
| » notes | body | string | false | Optional comment for the upload |
Example responses
207 Response
{
"status": "success",
"code": 207,
"message": "Projects successfully imported",
"details": {
"successes": [
{}
],
"errors": [
{}
]
}
}
400 Response
{
"status": "error",
"code": 400,
"message": "Invalid request",
"details": "Validation error"
}
401 Response
{
"status": "error",
"code": 401,
"message": "Authentication failed",
"details": "JWT token not found"
}
403 Response
{
"status": "error",
"code": 403,
"message": "Access denied",
"details": "Insufficient permissions"
}
404 Response
{
"status": "error",
"code": 404,
"message": "Not found",
"details": "The requested resource was not found"
}
409 Response
{
"status": "error",
"code": 409,
"message": "Conflict",
"details": "Locking conflict"
}
500 Response
{
"status": "error",
"code": 500,
"message": "Internal server error",
"details": "An internal server error occurred"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 207 | Multi-Status | Projects successfully imported | Inline |
| 400 | Bad Request | Invalid request or missing required parameters | ErrorResponse |
| 401 | Unauthorized | Authentication error (JWT token missing/invalid) | ErrorResponse |
| 403 | Forbidden | Access denied (insufficient permissions) | ErrorResponse |
| 404 | Not Found | Resource not found | ErrorResponse |
| 409 | Conflict | Locking conflict or version conflict | ErrorResponse |
| 500 | Internal Server Error | Internal server error | ErrorResponse |
Response Schema
Status Code 207
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » status | string | false | none | none |
| » code | integer | false | none | none |
| » message | string | false | none | none |
| » details | object | false | none | none |
| »» successes | [object] | false | none | none |
| »» errors | [object] | false | none | none |
