Skip to main content

TDS XML API

This document outlines the XML-API to communicate with TDS. The XML-API allows you to write custom programs that work with the template or inspection data stored by TDS.

warning

TDS XML parsing does not support XML comments in the form of

<myTag>
<!-- a comment to my value below -->
<myValue>25</myValue> <!-- or an inline comment -->
</myTag>
note

Example code snippets on this page will often use https://tds.example.com as the domain of the TDS host. Those need to be replaced accordingly.

Authenticating against TDS

TDS uses an authentication token combined with the HTTP basic-auth protocol. After you have successfully authenticated against TDS, the server will send you an auth token as part of the HTTP response. That auth token must be present in each HTTP request sent to the API.

Obtaining an auth token

Send an HTTP POST request to /users/get_token with the following fields and a Content-type of application/x-www-form-urlencoded:

User[login]=${LOGIN}
User[password]=${PASSWORD}

where ${LOGIN} and ${PASSWORD} represent username and password, respectively.

If the login is successful, TDS will respond with 200 OK, and the auth token will be included in the XML response. e.g.

<token>OTJkNTBiNDUtZDA3MC00M2NlLTljY2YtMjM2NTJlNWU5YmE2</token>

If the login was unsuccessful, TDS will reply with 401 Unauthorized.

note

By default, TDS runs with TLS and only accepts HTTPS connections. This can be disabled in the settings to allow for plain-text connections. This is highly discouraged.

Using the auth token

The auth token must be included with each HTTP request sent to TDS. Each request must have the following header:

Authorization: Token: ${AUTH-TOKEN}

where ${AUTH-TOKEN} is your auth token.

Ending your session

Send a POST request to /users/end_session

Make sure to include your auth token as outlined in the previous section.

Reading inspections

The most common use-case for programmatic TDS interaction is the regular query for new inspection. They can be read by accessing the /inspections HTTP endpoint.

This will return an XML of the following form:

<inspections>
<Inspection>
<!-- inspection 1 -->
</Inspection>
<Inspection>
<!-- inspection 2 -->
</Inspection>
<Inspection>
<!-- inspection 3 -->
</Inspection>

<!-- ..... -->
</inspections>

By default this endpoint returns an overview over the last 10 inspections. Each <Inspection> tag contains meta-data about the inspection but the individual checks are omitted.

The /inspection endpoint supports the following query parameters:

ParameterOptionsdefaultBehavior
limitpos. int / -110will only include this many inspections in the response, -1 for unlimited
offsetpos. int0will omit this many inspections for the query - can be used for pagination
user-idpos. int, comma separated list-filters for inspections created by any of the listed users
part-idpos. int, comma separated list-filters for inspections that belong to any of the listed parts
route-idpos. int, comma separated list-filters for inspections that belong to any of the listed routes
group-idpos. int, comma separated list-filters for inspections that belong to a part within any of the listed groups
insp-namestring-filters for inspections with this name
jointweld/bond-filters for inspections of this type
has-failure01/0when enabled only filters for inspections that contain failed checks
date-startdate-time in ISO8601-filters for inspections created after this point in time
date-enddate-time in ISO8601-filters for inspections created before this point in time
uploaded-date-startdate-time in ISO8601-filters for inspections uploaded after this point in time
uploaded-date-enddate-time in ISO8601-filters for inspections uploaded before this point in time
note

The date-time strings should be of the form YYYY-MM-DDThh:mm:ss.

Example: Query all new inspections

A common use-case is to have a scheduled task query TDS for new inspections. This can be done by providing the timestamp of the most recent, knwon inspection and querying all inspections since after that.

E.g., given the most recent inspection that has been returned by my last query was on 2024-10-10 15:22:14, the respecitve next query would look like this:

https://tds.example.com/inspections?limit=-1&uploaded-date-start=2024-10-10 15:22:14

Reading a single inspection

To view a single inspection, use the endpoint /inspections/${N}, where ${N} is the Id of the inspection you want to view. The results contain not only the inspection XML, as described in the following section, but also all weld (bond) checks, and measurements associated with the inspection.

XML description

The root XML object is <inspections>. Each <Inspection> sub-object has the following fields:

FieldDescription
idprimary key
uidUnique ID from the RSWA. May not be unique in the server db
created_timeTime the inspection was inserted into TDS
modified_timetime inspection was last modified on the RSWA
modified_countnumber of times inspection was modified on the RSWA
user_idID of user who took the inspection
user_namename of user who took the inspection
part_idID of part inspected
part_uidUID of the part inspected
part_namename of part inspected
route_namename of route on part inspected
device_uidunique ID of the RSWA from which the inspection originated
device_serialserial number of the device
createdTime the inspection was created on the RSWA
route_idID of the route
route_uidUID of the route
tz_biastimezone bias
template_revisionwhich template revision was active on the RSWA during time of inspection
bond_check_countnumber of adhesive bonds checked
bond_check_failednumber of adhesive bonds failed
weld_check_countnumber of welds checked
weld_check_failednumber of welds failed
jointjoint type. Either Weld or Bond
materialmaterial type. Either Steel or Aluminum

Checks

If you are viewing a single inspection, then additionally each <Inspection> object contains zero or more <WeldCheck> (or <BondCheck>) objects.

Weld checks contain the following XML fields:

FieldDescription
idinternal database id
positionThe position of the check within the inspection
decisionPass/fail decision
decision_textOptional text for the pass/fail decision
captiondescriptive text
inspection_idId of the parent inspection
reason_idId of the pass/fail reason selected
weld_idId of the weld measured

Bond checks contain the following XML fields:

FieldDescription
idinternal database id
positionThe position of the check within the inspection
decisionPass/fail decision
decision_textOptional text for the pass/fail decision
captiondescriptive text
inspection_idId of the parent inspection
reason_idId of the pass/fail reason selected
bond_idId of the bond measured

Measurements

If you are viewing a single inspection, then additionally each <WeldCheck> (or <BondCheck>) object contains zero or more <WeldMeasurement> or (<BondMeasurement>) objects.

Weld measurements contain the following XML fields:

FieldDescription
idInternal database id
slotSlot of the measurement (for 3T welds, either 1 or 2)
weld_check_idId of the associated weld check
cscanEncoded cscan image data
setup_front_thicknessFront plate thickness measured by setup
setup_middle_thicknessMiddle plate thickness measured by setup
alg_versionVersion of the algorithm used
setup_proc_attr
out_front_thickFront plate thickness measured
out_stack_thickStack thickness measured
out_indentationIndentation measured
circle_auto_xAutomatic circle x coordinate
circle_auto_yAutomatic circle y coordinate
circle_auto_diameterAutomatic circle diameter
circle_man_xManual circle x coordinate
circle_man_yManual circle y coordinate
circle_man_diameterManual circle diameter
warning_flagsWarning flags from the RSWA
timestampTime measurement was taken

Bond measurements contain the following fields:

FieldDescription
idInternal database id
slotSlot of the measurement (where it appears along the bead)
bond_check_idId of the associated bond check
cscanEncoded cscan image data
setup_front_energyFront plate thickness measured by setup
alg_versionVersion of the algorithm used
setup_proc_attr
out_front_thickFront plate thickness measured
bead_auto_rho
bead_auto_theta
bead_auto_widthAutomatically detected width of the bead
bead_man_rho
bead_man_theta
bead_man_widthManually adjusted width of the bead
warning_flagsWarning flags from the RSWA
timestampTime measurement was taken

Accessing the product catalog

Filtering the inspection list based on group, part, route, etc. requires you to use the id's of the various items. To obtain these values, use the following HTTP endpoints:

  • /groups
  • /parts
  • /routes

Additional endpoints that can be queried for product data are:

  • /images
  • /welds
  • /bonds
  • /presets
  • /hot_spots
  • /devices
  • /categories
  • /reasons
  • /revisions
  • /users
  • /version
  • /reports
  • /measurements
  • /search

TDS tries to provide a RESTful API which means that the following commmands are generally accepted:

CommandInvocation
indexHTTP GET to /<endpoint>
viewHTTP GET to /<endpoint>/{id}
addHTTP POST to /<endpoint>
editHTTP PATCH/POST to /<endpoint>/{id}
deleteHTTP DELETE to /<endpoint>/{id}
actionsHTTP POST to /<endpoint>/<action-keyword> or /<endpoint>/<action-keyword>/{id}

Not all endpoints provide all commands and some may provide additional commands through certain action keywords. Both will be listed below for the each endpoint individually.

All requests with an XML body must contain <request> as the root tag. The requests index, view, and delete do not require an HTML body.

Note, that any data manipulation through the XML api should be run on a test system before going into production. TDS checks for data validity in many places but data corruption might occur on invalid input.

Groups

The /groups endpoint provides the commands

  • index
  • view
  • add
  • edit
  • delete

Due to legacy reasons, rather than just listing the groups the index and view methods provide a part tree. Sending GET to the /group endpoint returns the full part tree with all nested groups and parts.

Starting with v4.0.2: To just get the list of groups, send an HTTP GET request to the /groups/light endpoint which will just list the nested group structure.

The resulting XML contains the following fields:

FieldDescription
idInternal database id
uidUniversal id
parent_idId of parent group, if it exists
nameName of the group
createdDate of creation
modifiedDate last modified
deleted1 if the group is deleted, 0 otherwise
delete_dateif the deleted field is 1, the date of deletion
commentUser-provided comment

To add or edit a new group use the add command via an HTTP POST request to the /groups endpoint with a content XML of the same layout as the above. Note, that the root tag must be <request>.

Parts

The /parts endpoint provides the commands

  • index
  • view
  • add
  • edit
  • delete

Due to legacy reasons, rather than listing all parts, the index command just displays the top level parts - parts that do not have an associated group.

Starting with v4.0.2: Sending a GET request to the /parts/all endpoint returns a list of all parts - including those in groups and sub-groups.

Either way, the resulting XML contains the following fields:

FieldDescription
idInternal database id
uidUniversal id
group_idId of parent group, if it exists
nameName of the group
createdDate of creation
modifiedDate last modified
deleted1 if the part is deleted, 0 otherwise
delete_dateif the deleted field is 1, the date of deletion
commentUser-provided comment
weld_countNumber of welds in the part
bond_countNumber of bonds in the part
measurement_typerswa steel, rswa aluminum, abis steel, or abis aluminum
metaUser-provided metadata

When using the view command to get a single part, the following additional fields will be present:

FieldDescription
Weldfull weld object, repeated for every weld
Bondfull bond object, repeated for every bond
Imagefull image object, repeated for every image
Routefull route object, repeated for every route

To add a new part use the add command via an HTTP POST request to the /parts endpoint with a content XML of the same layout as the above. Note, that the root tag must be <request>.

The fields which can be set manually for add and update are:

  • id
  • uid
  • group_id
  • name
  • created
  • modified
  • deleted_date
  • measurement_type
  • meta
  • comment

Please note, deleting a part deletes all associated welds, routes and images recursively. Adding a new part however, does not work recursively. In order to populate a full part with welds/bonds, images and routes, each have to be added successively.

The proper way would be to add a part, then add the welds/bonds referencing the part - via the id returned by TDS for the part -, then add the images referencing the part, and finally add the routes where each route item references image and weld respectively.

Routes

The /routes endpoint provides the commands

  • view
  • add
  • edit
  • delete

To get the list of parts, use the index command via an HTTP GET request to the /routes endpoint. The resulting XML contains the following fields:

FieldDescription
idInternal database id
uidUniversal id
part_idId of parent part
nameName of the group
deleted1 if the route is deleted, 0 otherwise
delete_dateif the deleted field is 1, the date of deletion
route_item_countNumber of route items in the route
measurement_typerswa steel, rswa aluminum, abis steel, or abis aluminum
commentUser-provided comment

To add a new route use the add command via an HTTP POST request to the /routes endpoint with a content XML of the same layout as the above. Note, that the root tag must be <request>.

Route Items

The /route_items endpoint provides the commands

  • add

Due to legacy reasons, additionally, a /route_items/delete endpoint is provided to remove route_items

To add a new route item, post an XML request like the following to /route_items:

<request>
<route_id>2</route_id>
<before_position>0</before_position>
<RouteItem>
<weld_id>207</weld_id>
</RouteItem>
</request>

With the fields representing the following data:

FieldDescription
route_idDatabase ID of the route this item belongs to
before_positionThe position before which this route_item will be inserted
RouteItemMay be repeated to add multiple
weld_idThe ID of the weld this item is associated with (or bond_id in case of a bond)

To delete a route item, post an XML like the following to the /route_items/delete endpoint:

<request>
<route_id>2</route_id>
<RouteItem>
<position>0</position>
</RouteItem>
</request>

Here, position represents the index of the route item that is to be removed - starting with index 0.

Images

The /images endpoint provides the commands

  • view
  • add
  • delete

To receive a single image with its respective meta data, send an HTTP GET request to the /images/{id} endpoint, where {id} is the id of the desired image. The resulting XML contains the following fields:

FieldDescription
idInternal database id
uidUniversal id
part_idId of parent part
widthWidth of the image in pixels
heightHeight of the image in pixels
positionPosition in relation to other images. Smaller positions are located before higher ones.
crc32CRC32 checksum of the image's data
thumbnailBase64 encoded thumbnail - quality reduced preview of the full image
dataBase64 encoded image data
metaArbitrary meta data that may be passed along with the image. Is shown on export.

To add a new image use the add command via an HTTP POST request to the /images endpoint with a content XML of the same layout as the above. Note, that the root tag must be <request>.

Welds

The /welds endpoint provides the commands

  • add
  • edit
  • action - "delete"

To add a new weld use the add command via an HTTP POST request to the /welds endpoint with a content XML of the same layout as the above. Note, that the root tag must be <request>.

The containing <Weld> XML may contain the following tags:

FieldDescription
idInternal database id
uidUniversal id
part_idId of parent part
nameName of the weld
slotsNumber of slots for this weld (1 or 2)
stack_frontstack width of front plate
stack_middlestack width of center plate
stack_backstack width of back plate
diameter_minminimum acceptable diameter
diameter_targetminimum targeted diameter
indentation_minminimum indentation of weld
indentation_maxmaximum indentation of weld
category_idoptional category the weld belongs to
thickness_minminimum plate thickness after weld
thickness_maxmaximum plate thickness after weld
scheduleweld schedule
hot_spot_countAmount of hot spots associated with this weld
route_item_countAmount of route items associated with this weld
robotOptional name of the assigned robot
metaArbitrary meta data that may be passed along with the image. Is shown on export.
commentOptional comment regarding the weld

To delete a weld, send a post request to /welds/delete with an XML like the following:

<request>
<Weld>
<id>{id}</id>
</Weld>
<Weld><!-- possibly repeated for other welds --></Weld>
</request>

where {id} is the id of the weld that is to be deleted.

Bonds

The /bonds endpoint provides the commands

  • add
  • edit
  • action - "delete"

To add a new bond use the add command via an HTTP POST request to the /bonds endpoint with a content XML of the same layout as below. Note, that the root tag must be <request>. The containing <Bond> XML may contain the following tags:

FieldDescription
idInternal database id
uidUniversal id
part_idId of parent part
nameName of the bond
slotsNumber of slots for this bond (1 or 2)
stack_frontstack width of front plate
stack_backstack width of back plate
category_idoptional category the bond belongs to
bead_minminum diameter of adhesive bead
hot_spot_countAmount of hot spots associated with this bond
route_item_countAmount of route items associated with this bond
robotOptional name of the assigned robot
metaArbitrary meta data that may be passed along with the image. Is shown on export.
commentOptional comment regarding the bond

To delete a bond, send a post request to /bonds/delete with an XML like the following:

<request>
<Bond>
<id>{id}</id>
</Bond>
<Bond><!-- possibly repeated for other bonds --></Bond>
</request>

where {id} is the id of the bond that is to be deleted.

Presets

The /presets endpoint provides the commands

  • index
  • add
  • edit
  • delete

To get the list of presets, use the index command via an HTTP GET request to the /presets endpoint. The resulting <Preset> XML contains the following fields:

FieldDescription
idInternal database id
nameName of the preset
dataa JSON string containing the preset parameters as key-value pairs

The data JSON is of the form

{
"type": "v3weld", // Fix value
"absolute-adjustment": 0, // Valid values: decimal value between [-0.002 - 0.002]
"min-size-adjustment": "off", // Valid values: off / on
"peak-detector": "standard", // Valid values: standard / aggressive / smart
"echo-shape-processing": "off", // Valid values: off / on
"secondary-echo-processing": "off", // Valid values: off / subtle / moderate / full
"surface-follower": 0 // Valid values:
}

The values might differ depending on the configuration at hand.

To add a new preset use the add command via an HTTP POST request to the /presets endpoint with a content XML of the same layout as the above. Note, that the root tag must be <request> tag.

Hotspots

The /hot_spots endpoint provides the commands

  • add

Due to legacy reasons, additionally, a /hot_spots/delete endpoint is provided to remove hotspots

To add a new hotspot, post an XML request like the following to /hot_spots:

<request>
<image_id>3</image_id>
<HotSpot>
<weld_id>1</weld_id>
<data>...</data>
</HotSpot>
</request>

With the fields representing the following data:

FieldDescription
image_idDatabase ID of the image this hotspot belongs to
HotspotMay be repeated to add multiple
weld_idThe ID of the weld this item is associated with (or bond_id in case of a bond)
dataa JSON string the location of the hotspot on the image as well as the location label location

The data field containing the hotspot location as json encoded string has the following format:

{
"lx":836,
"ly":132,
"ts": [{
"x":690,
"y":127
}]
}

lx and ly represent the center coordinates of the hotspot label and x/y represent the coordinates of the hotspot itself. Both coordinates are given in pixels.

To delete a hotspot, post an XML like the following to the /hot_spots/delete endpoint:

<request>
<image_id>2</image_id>
<HotSpot>
<weld_id>1</weld_id>
</HotSpot>
</request>

Devices

The /devices endpoint provides the commands

  • index
  • delete

To list the RSWA devices paired with a TDS server, send an HTTP GET request to the /devices endpoint. The resulting <Device> XML contains the following fields:

FieldDescription
idInternal database id
uidUniversal id
serialthe device's 4 digit serial number
softwarearray explorer software version installed on the device
namehuman readable name as displayed in the device manager
ipdevice's ip address
affiliationdeprecated
createdtime stamp of the device registration
modifiedtime stamp of the last device modification

Categories

The /categories endpoint provides the commands

  • index
  • add
  • edit
  • delete

To list the weld/bond categories, send an HTTP GET request to the /categories endpoint with parameter type set to 1 for weld categories or 2 for bond categories. The resulting <Category> XML contains the following fields:

FieldDescription
idInternal database id
uidUniversal id
namename of the category
colorRGB color of the category, e.g. 00FF00 for green
type1 for weld categories, 0 for bond categories

To add a new category use the add command via an HTTP POST request to the /categories endpoint with a content XML of the same layout as the above. Note, that the root tag must be <request> root tag.

Reasons

The /reasons endpoint provides the commands

  • index
  • add
  • edit
  • delete

To list the reasons, send an HTTP GET request to the /reasons endpoint. The resulting <Reason> XML contains the following fields:

FieldDescription
idInternal database id
uidUniversal id
captiontitle of the reason
type1 for weld reason, 0 for bond reason
createddate of reason creation
deleted1 if the group is deleted, 0 otherwise
delete_dateif the deleted field is 1, the date of deletion
positionrelative display position with respect to the other reasons

To add a new reason use the add command via an HTTP POST request to the /reasons endpoint with a content XML of the same layout as the above. Note, that the root tag must be <request> tag.

Revisions

The /revisions endpoint provides the commands

  • index
  • add
  • delete
  • action - send_revision_to_device

To list the revisions, send an HTTP GET request to the /revisions endpoint. The resulting <Revision> XML contains the following fields:

FieldDescription
idInternal database id
nametitle of the revision
md5MD5 hash over the revision payload
createddate of reason creation
deleted1 if the group is deleted, 0 otherwise
delete_dateif the deleted field is 1, the date of deletion

To add a new reason use the add command via an HTTP POST request to the /revisions endpoint with a content XML of the same layout as the above. Note, that the root tag must be <request> tag. When creating new revisions, there is no need to provide a md5 checksum, as it will be generated by TDS.

send_revision_to_device

Available since TDS + RSWA v4.3.0

This action allows to trigger the revision download to the device. The request body must look like this and be posted to revisions/send_revision_to_device/<rev-id>:

<request>
<device_uid>22a3ff3f-ba12-4acf-867e-d4a5057d992e</device_uid>
<force_activate>true</force_activate>
</request>
FieldDescription
rev-idthe ID of the revision which should be downloaded to the device
device_uidthe UID of the device the revision should be downloaded to
force_activateset to true in order have the RSWA activate the revision immediately

Note, that the request handling is synchronous. The success/error response will be sent back once the full revision download actually succeeds or fails.

Depending on the revision size and the network bandwidth, this can take longer than other operations. Make sure, to extend the request timeout correspondingly.

Users

The /users endpoint provides the commands

  • index
  • view
  • add
  • edit
  • delete
  • action "get_token", "end_session"

To list the users, send an HTTP GET request to the /users endpoint. The resulting <User> XML contains the following fields:

FieldDescription
idInternal database id
uidUniversal id
nameprimary user name
alt_idadditional user name info
image_indexIndex of the image associated with user (0-10)
createddate of user creation
modifieddate of user modification
deleted1 if the group is deleted, 0 otherwise
delete_dateif the deleted field is 1, the date of deletion
loginlogin name
pwd_hashpassword hash used for authentication
pwd_hash_publicpassword hash used for authentication
purged_ondate of user purge
Ugrouppossibly repeated index of the user group the user belongs to (1-7)

The user groups are

  1. standard
  2. advanced
  3. admin
  4. editor
  5. reporter
  6. transfer
  7. supervisor

To add a new reason use the add command via an HTTP POST request to the /users endpoint with a content XML of the same layout as the above. Note, that the root tag must be <request>.

When creating new users, pwd_hash and pwd_hash_public cannot be provided as they are generated by TDS. To create a user with a password the <password> may be provided instead of <pwd_hash> and pwd_hash_public. TDS will generate the appropriate hashes automatically. Note, that an SSL encrypted connection is strongly encouraged. Otherwise, the passwords will be transmitted across the network in clear readable form.

To add user groups, the syntax is slightly different from the table above. An XML for inserting a user may look like this:

<request>
<User>
<name>Readable user name</name>
<alt_id>alternative name</alt_id>
<image_index>1</image_index>
<login>loginname</login>
<password>password1234</password>

<!-- starting with TDS V4.0.1 passwords can and should be base64 encoded -->
<pw64>cGFzc3dvcmQxMjM0</pw64>

<!-- starting with TDS V4.0.1 it can be written as -->
<Ugroup>
<id>3</id> <!-- one id for every group -->
<id>1</id> <!-- one id for every group -->
</Ugroup>
</User>

<!-- TDS V4.0.0 and below require -->
<Ugroup>
<Ugroup>3</Ugroup>
<Ugroup>1</Ugroup>
</Ugroup>
</request>

The get_token and end_session actions are explained in the authentication section.

Version

To get the TDS version, send an HTTP GET request to the /version endpoint. The response <version> XML will look contain the TDS version. For TDS 2 this would be

<version>2</version>

Reports

The /reports endpoint only provides the summary action. This can be accessed by sending an HTTP GET request to /reports/summary.

FieldDescription
num_weldsnumber of registered welds
num_bondsnumber of registered bonds
num_imagesnumber of registered images
num_routesnumber of registered routes
num_groupsnumber of registered groups

The /search endpoint only provides the index command. By sending an HTTP GET request to /search a list of all part groups, parts, welds, bonds, and users is returned with their respective id, name and optionally a parent id in case of hierarchical parts.

The <Result> response is returned once for every result and contains the following fields

FieldDescription
typeGroup, Part, Weld, Bond, or User
idid of the result object
textname/identifier of result object
parent_idin case of hierarchical object, optionally the parent object id

Examples

The following snippets show how the TDS api can be accessed with CURL or Python. Note, that all of these snippets ignore SSL certificate errors since TDS ships with self-signed certificates which would be rejected by proper certificate checks.

CURL

To authenticate against TDS and obtain a user token, the following CURL command can be executed.

curl -X POST --insecure -H "Content-Type: application/x-www-form-urlencoded" -d 'User[login]=<your-username>' -d 'User[password]=<your-password>' https://<your-tds-address>/users/get_token

Just replace <your-username>, <your-password> and <your-tds-address> respectively.

To request any of the endpoints - the parts catalogue in this example - provide the obtained user token and execute the following command.

curl -X GET --insecure -H "Authorization: Token: <your-token>" https://<your-tds-address>/parts/all

Just replace <your-token> with the obtained user token.

To post to any of the endpoints - and add a new part in this example - create the appropriate XML-document and send it to the respective endpoint.

curl -X POST --insecure -H "Authorization: Token: <your-token>" -T <your-xml-file> https://<your-tds-address>/parts

Just replace <your-token> with the user token, <your-xml-file> with the path to the prepared xml body and <your-tds-address> with the address to your TDS server.

Python

The following Python code snippet authenticates against a TDS instance (<your-tds-address>) with <your-username> and <your-password>, downloads a specific inspection report (inspection with id 1 in this case) and print all the contents of that inspection.

This snippet relies on the 3rd party requests library which can be installed with pip install requests.

import requests
import xml.etree.ElementTree as ET

TdsAddress = "https://<your-tds-address>"
InspectionID = "1" ## Or any other inspection you want to download

User = "<your-username>"
Pass = "<your-password>"

## Get the authentication token
tokenXml = requests.post(
f"{TdsAddress}/users/get_token",
verify=False,
headers={"Content-type": "application/x-www-form-urlencoded"},
data=f"User[login]={User}&User[password]={Pass}",
)
token = ET.fromstring(tokenXml.text).text

## Get all inspections
## inspectionsXml = requests.get(f"{TdsAddress}/inspections")

## Get a single inspection
inspectionXml = requests.get(
f"{TdsAddress}/inspections/{InspectionID}",
verify=False,
headers={"Authorization": f"Token: {token}"},
)
inspectionTree = ET.XML(inspectionXml.text)

for child in inspectionTree:
print("Inspection:")
for item in child:
print(f"{item.tag}: {item.text}")

A full example to upload a part with a couple of welds, images and a route is provided here: [Full Part Import Example](Part Import Example/main.md)