I would like to update the status of existing jobs in XTRF smart projects using the XTRF Home Portal API. The API call requires a job ID, but I don't where to find this ID.
End point:
.../v2/jobs/{jobId}/status
Following the solution of a similar post, I have defined a view with a list of jobs that require updating. However, there seems to be no column that holds the {jobId} that is required for the API. There is a column called "Internal ID" that contains a 4-digit number. But when I use that number in the API call, there's an error:
"Invalid Job ID of a Smart Job. Use new form of Job ID for Smart Jobs (e.g. 2QROVSCO3ZG3NM6KAZZBXH5HMI)."
So apparently, there is a new form for the job ID. Is there a specific column for the view that I should use, or is there another way to retrieve this job ID?
The Job ID can be found in the url (after clicking on a job):
https://[your xtrf url]/xtrf/faces/projectAssistant/projects/project.seam?assistedProjectId=5GB3QLPO2QROVSCOR55O3WJVU2Y#/project?jobs=DZAGF2QROVSCOVBJPG2UVBCJZ4II
The Job ID is DZAGF2QROVSCOVBJPG2UVBCJZ4II
Another way is to retrieve the jobs by the API itself, this can be done for a quote, but also for a project:
Endpoint: /v2/quotes/{quoteId}/jobs
Related
TL;DR: How do I relate a release to the tests visible in the Tests tab via the API?
I am running a Release Pipeline which executes tests against the website being deployed. The tests generate files (within my test code) and I want to use the DevOps REST API to attach those files to the Test report associated with the Release.
Note: I am running these tests as smoke tests after release as part of the release pipeline so that I can test the deployed website. This would not be possible as part of the build pipeline.
I can get the release information, but I'm having trouble identifying how to find the related test(s) and attach a file.
Additional: The link in this SO post appears to have been changed and no longer points to the intended page, but now points to the overall documentation for the REST API.
Currently, I believe the process should be:
Get release details
Get test run id
Get test case result id
Create test result attachment
The primary problem is getting the test run id and test case result id from the release information.
I guess I'm a bit late with this, but still.
You are right about the process. Getting Test run ID is possible via accessing logs of corresponding task inside the release. Here's the needed endpoint:
https://{organizationName}.vsrm.visualstudio.com/{projectName}/_apis/release/releases/{releaseID}/environments/{stageID}/deployPhases/{deployPhaseID}/tasks/{taskId}/logs
Please note that test run ID and test IDs will only be available after the test run task is finished.
I'd recommend getting release ID, stage ID and deployment phase ID directly from the release by accessing default variables provided by azure devops (e.g. $(Release.ReleaseId), other ones are easily googled) rather than fetching via API and matching by name, cause it takes time and does not return all releases, only 100 first or smth like that.
After this, you need to get TaskID. I found it possible and applicable looking for that by Task Name. Just fetch the release by it's ID via API and look for task which matches needed name using this endpoint:
https://{organizationName}.vsrm.visualstudio.com/{projectName}/_apis/release/releases/{releaseId}?api-version=5.0
Going through all the deploySteps, deployPhases, deployJobs to get the task name is a bit cumbersome, but possible (I used LINQ).
After getting these 4 base IDs, you are now able to get logs of the Run tests task. In received log I have used a regex to extract test run ID. Then, having test run ID, you can grab the list of test run results:
https://{organizationName}.visualstudio.com/{projectName}/_apis/test/runs/{testRunId}/results
To attach some files to a test, you will need this test's AzDo ID. How can you get it? Well, I can think of mapping the tests by their names (you will need to store a list of those beforehand) and then looping through fetched test results and the stored list. After a match is found, get the respective id, and attach anything you want:
https://{organizationName}.visualstudio.com/{projectName}/_apistest/Runs/{testRunId}/Results/{testId}/attachments?api-version=6.1-preview.1
I am building a rest API and want to implement a PATCH for a job manager monitoring tool.
All my clients know the job manager's job ID that is not unique. The job manager resets the jobs ID from time to time (so starting from 1 again) This happens at random intervals (can be months or days) for different reasons.
I want to let the job manager send me updates about a job but I don't want it to first do a GET to find out the job's unique ID (let's say DBid) and then do the PATCH /jobs/:DBid. This is because of performance and slow network reasons. Having to wait for the GET could block the job manager which is critical.
Selecting the latest job with the job manager ID will return the right job. But how to model this in a rest API?
You need the id of the job manager to be in a 'pot' on the server. I've worked on this type of thing where a client needs to know the internal id of a resource but that id rarely changes. It does change but very infrequently. The solution for that is a cache service but for this, it sounds like you need a 'pot', on the server, where the id is stored.
The endpoint handling the PATCH knows where the pot is on the server so can load the id from it. A simple flat file perhaps.
If the manager needs to change the id, whatever process handles that change, changes what's in the pot. So the PATCH endpoint is always getting the correct id from the pot.
You can add synchronisation for accessing the pot in case a PATCH comes in while the manager is updating the id.
I am using Google's Java API for an project.
Strangely, inserting a task without setting an id works fine. However, inserting a task with a id returns a 400 invalid value error. The id is to be used for syncing local data with Google Tasks
I'm pretty sure there's nothing wrong with the algorithm that generates the ids for the task. The same algorithm works perfectly for Google Calendar API.
Am I missing something here?
You may refer with this SO answer. It suggested to pass the id key/value pair together with the title information you are already sending. There's no documentation to indicate this is a required parameter, especially since it is included in the URL. Google requires the id of the task to be passed as a part of url, parameters and body.
I have begun digging around in the Google Cloud Print project in hopes of creating a custom application for my network. I have a Windows Print Server running with a printer queue I wish to submit jobs to. Setup the Google Cloud Print with the Crome browser and I was able to submit and print jobs just fine. However, my end goal is a little more complicated.
I need to customize the access control from the server-side client endpoint once the job reaches my network. Meaning, once the job is submitted, I need to be able to check the username of the owner of the job and process accordingly. From the looks of it, the /fetch interface does not store the original owner of the job, just the end owner of the queue it ends up on. Meaning, User A has the Google Cloud Printer linked to their account and has shared it with User B. User B submits a job to the shared queue. When I run /fetch on the shared printerID the user is User A.
Has anyone else dabbled with this?
Thanks
Take a look at the ownerId of the job.
The /fetch call does in fact return a user field containing the owner of the printer (User A), but the specific job(s) returned contains an ownerId field with a value of the user that submitted the print job (User B).
Hope that helps.
Following is a partial response from a /fetch call, including ownerId of the job. Keep in mind that this could be one of many jobs that are returned in the jobs array:
...
updateTime: "1403628993840",
status: "QUEUED",
ownerId: "rpreeves#gmail.com",
rasterUrl: "https://www.google.com/cloudprint/download?id=5ca7b1e4-c533-c42b-7d2b-efb862c4215a&forcepwg=1",
ticketUrl: "https://www.google.com/cloudprint/ticket?format=ppd&output=json&jobid=5ca7b1e4-c633-c42b-782b-efb862c4215a",
printerid: "f33c6ff8-fc25-7075-249b-ab65c3e2354e",
...
I need to know how to fetch the task id from within a BPMN process.
I tried the following without luck:
<serviceTask id="assignApplicationId" name="Assign Application Id"
activiti:expression="${sequenceUtil.getOutboundId(**task.id**)}"
activiti:resultVariable="OutboundWF_ApplicationNumber"/>
and
<serviceTask id="assignApplicationId" name="Assign Application Id"
activiti:expression="${sequenceUtil.getOutboundId(**bpm_taskid**)}"
activiti:resultVariable="OutboundWF_ApplicationNumber"/>
According to the manual, access to the DelegateTask only works for expressions evaluated in task listeners, so it does not seem to be possible to fetch the task ID with other expressions.