Import Tags via API
Using vScope’s API for importing tags or IP targets is an advanced feature. If you’re new to REST APIs, consider seeking assistance from a colleague experienced in this area. In this guide, I’ll demonstrate how to import manual tags into vScope using an XLSX file and the Postman tool.
Getting Started with Postman
Download and Install Postman
Postman is a free tool that simplifies API requests. Start by downloading and installing Postman. Ensure your computer can access vScope so that Postman can connect to the vScope Server.
Preparing the Excel File
In this example, we will import a tag named "Your Manual Tag"
for servers. If you don’t have an XLSX file prepared, you can export one with server names from vScope. Note the resource type in the top left corner.
Open the file in Excel, add the desired tag (e.g., "Your Manual Tag"
), and save it.
Creating an API Token in vScope
To allow Postman to communicate with vScope, create an API token:
- Navigate to vScope > Settings > API Tokens > +Add Token.
- Choose a user authorized to access the target resource and set the token’s active duration.
After creating, the token will appear in the list and is ready for use in Postman.
Configuring Postman
- Open Postman and set the request method to
POST
. - Enter your vScope URL followed by
/rest/action/bulktag/xlsx
.
For example: https://vscope.example.com/rest/action/bulktag/xlsx
Adding the API Token
To authorize the request:
- Add the API token as a query parameter:
?token=[your_vscope_token]
.
Specifying Information for Tag Import
Define parameters in the request URL to specify what you want vScope to do with the XLSX data.
Example URL structure with parameters:
https://vscope.example.com/rest/action/bulktag/xlsx?token=1b644eddc79a5f5&resourceType=All%20Machines&matchColumn=Name&matchTag=Name&valueColumn=Your%20Manual%20Tag&apply=false
Explanation of Parameters
-
resourceType = All Machines
Specifies the resource type to match (e.g., All Machines in our example). -
matchColumn = Name
Defines the column in the Excel sheet with values to match rows in vScope (e.g., Name). -
matchTag = Name
Specifies which tag in vScope to match with the values in matchColumn. -
valueColumn = Your Manual Tag
Points to the column in the sheet with values to be added as tags in vScope. -
apply = false
Use false for testing; set to true to commit the changes after verifying.
Setting Content-Type Header
Go to the Headers section in Postman and set:
- Key:
Content-Type
- Value:
application/octet-stream
Uploading the XLSX File in Postman
- Go to Body.
- Select binary.
- Click Select File and upload your XLSX file.
Testing and Importing Tags to vScope
With apply=false, click Send to test the request. The response will indicate how many rows are ready to be updated. If the count matches, set apply=true to proceed with the import.