<?xml version="1.0" encoding="UTF-8"?> <chapter xml:id="api.jobs" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.0" > <title> Jobs - List and manage job specifications </title> <para> These methods allow you to list, edit, and maintain job specifications in your Perforce server. </para> <informaltable> <tgroup cols="2"> <colspec colname="topic" colwidth="*"/> <colspec colname="description" colwidth="*"/> <thead> <row> <entry> <para>Path</para> </entry> <entry> <para>Description</para> </entry> </row> </thead> <tbody> <row> <entry> <para> <link linkend="api.jobs.v1_jobs_GET"> <literal>GET /v1/jobs</literal> </link> </para> </entry> <entry> <para>List available jobs</para> </entry> </row> <row> <entry> <para> <link linkend="api.jobs.v1_jobs_POST"> <literal>POST /v1/jobs</literal> </link> </para> </entry> <entry> <para>Create a new job specification</para> </entry> </row> <row> <entry> <para> <link linkend="api.jobs.v1_jobs_id_GET"> <literal>GET /v1/jobs/[job]</literal> </link> </para> </entry> <entry> <para>Describe a single job specification</para> </entry> </row> <row> <entry> <para> <link linkend="api.jobs.v1_jobs_id_PATCH"> <literal>PATCH /v1/jobs/[job]</literal> </link> </para> </entry> <entry> <para>Update a job specification</para> </entry> </row> <row> <entry> <para> <link linkend="api.jobs.v1_jobs_id_DELETE"> <literal>DELETE /v1/jobs/[job]</literal> </link> </para> </entry> <entry> <para>Delete a job specification</para> </entry> </row> </tbody> </tgroup> </informaltable> <section xml:id="api.jobs.v1_jobs_GET"> <title><literal>GET /v1/jobs</literal></title> <para> Lists available jobs in the system. </para> <para> The resources of this list are summaries of jobs in the system. For more details of each job, append the <literal>job</literal> property the end of this URL. </para> <para> There are no other parameters to this method. </para> <para> This method requires authentication. See <link linkend="clientprog.authentication">Perforce Web API Authentication</link> </para> <simplesect xml:id="api.jobs.v1_jobs_GET.response_data"> <title>Response Data</title> <para> Returns fields available from the <literal>p4 -ztag jobs</literal> command. For more information, see the <ulink url="http://www.perforce.com/perforce/doc.current/manuals/cmdref/p4_jobs.html"> <literal>p4 jobs</literal> command reference. </ulink>. </para> <informaltable> <tgroup cols="4"> <colspec colname="parameter" colwidth="*"/> <colspec colname="description" colwidth="4*"/> <colspec colname="type" colwidth="*"/> <colspec colname="required" colwidth="*"/> <thead> <row> <entry> <para>Parameter</para> </entry> <entry> <para>Description</para> </entry> <entry> <para>Type</para> </entry> <entry> <para>Required</para> </entry> </row> </thead> <tbody> <row> <entry><literal>Job</literal></entry> <entry>The job name and primary ID</entry> <entry>string</entry> <entry>Yes</entry> </row> <row> <entry><literal>Status</literal></entry> <entry>The job status, customizable in your system</entry> <entry>string</entry> <entry>Yes</entry> </row> <row> <entry><literal>User</literal></entry> <entry>Perforce login of the current job owner</entry> <entry>string</entry> <entry>Yes</entry> </row> <row> <entry><literal>Description</literal></entry> <entry>The job description, probably contains multiple lines.</entry> <entry>string</entry> <entry>Yes</entry> </row> <row> <entry><literal>Date</literal></entry> <entry>Epoch timestamp when the job was created</entry> <entry>number</entry> <entry>Yes</entry> </row> </tbody> </tgroup> </informaltable> </simplesect> <simplesect xml:id="api.jobs.v1_jobs_GET.example"> <title>Example</title> <para>Our standard authenticated request format for listing jobs:</para> <programlisting> GET /v1/jobs HTTP/1.1 Authorization: Basic c3VwZXI6NzcxMmJkMTAtOGQxMi00ZmUwLTgxM2MtZmM2OTExODQ3Yjdj</programlisting> <para> Here's an example of a list with one job in the response: </para> <programlisting language="json"> HTTP/1.1 200 OK Content-Type: application/json [{ "Job": "job000001", "Status": "open", "User": "super", "Date": 1416868098, "Description": "You need to get to work mr super\n" }]</programlisting> </simplesect> </section> <section xml:id="api.jobs.v1_jobs_POST"> <title><literal>POST /v1/jobs</literal></title> <para> Creates a new job specification. </para> <para> Upon success, this will return a 303 redirect to the new job specification resource that has been created. </para> <para> If the job already exists, this method will replace the existing job completely. </para> <para> This method requires authentication. See <link linkend="clientprog.authentication">Perforce Web API Authentication</link> </para> <simplesect xml:id="api.jobs.v1_jobs_POST.parameters"> <title>Parameters</title> <informaltable> <tgroup cols="5"> <colspec colname="parameter" colwidth="*"/> <colspec colname="description" colwidth="4*"/> <colspec colname="type" colwidth="*"/> <colspec colname="paramtype" colwidth="*" /> <colspec colname="required" colwidth="*"/> <thead> <row> <entry> <para>Parameter</para> </entry> <entry> <para>Description</para> </entry> <entry> <para>Type</para> </entry> <entry> <para>Parameter Type</para> </entry> <entry> <para>Required</para> </entry> </row> </thead> <tbody> <row> <entry><literal>Job</literal></entry> <entry>The job name and primary ID, should probably be set to <literal>new</literal></entry> <entry>string</entry> <entry>body</entry> <entry>Yes</entry> </row> <row> <entry><literal>Status</literal></entry> <entry>The job status, customizable in your system, should probably be <literal>open</literal>.</entry> <entry>string</entry> <entry>Yes</entry> </row> <row> <entry><literal>User</literal></entry> <entry>Perforce login of the current job owner</entry> <entry>string</entry> <entry>Yes</entry> </row> <row> <entry><literal>Description</literal></entry> <entry>The job description, probably contains multiple lines.</entry> <entry>string</entry> <entry>Yes</entry> </row> </tbody> </tgroup> </informaltable> </simplesect> <simplesect xml:id="api.jobs.v1_jobs_id_POST.example"> <title>Example</title> <para> We'll create a simple job. </para> <programlisting language="json"> POST /v1/jobs HTTP/1.1 Authorization: Basic c3VwZXI6NzcxMmJkMTAtOGQxMi00ZmUwLTgxM2MtZmM2OTExODQ3Yjdj Content-Type: application/json { "Job": "new", "Status": "open", "Owner": "juser", "Description": "Make an example" }</programlisting> <para> The return value should be a redirect to the details page of the new job. </para> <programlisting> HTTP/1.1 303 Found Location: http://example.com/p4/v1/jobs/job00002</programlisting> <para> You may need to recall that the URL returned by a 303 response should be accessed via <literal>GET</literal>, and not via <literal>POST</literal>. </para> </simplesect> </section> <section xml:id="api.jobs.v1_jobs_id_GET"> <title><literal>GET /v1/jobs/[job]</literal></title> <para> Return job details. </para> <para> This method requires authentication. See <link linkend="clientprog.authentication">Perforce Web API Authentication</link> </para> <simplesect xml:id="api.jobs.v1_jobs_id_GET.parameters"> <title>Parameters</title> <informaltable> <tgroup cols="5"> <colspec colname="parameter" colwidth="*"/> <colspec colname="description" colwidth="4*"/> <colspec colname="type" colwidth="*"/> <colspec colname="paramtype" colwidth="*"/> <colspec colname="required" colwidth="*"/> <thead> <row> <entry> <para>Parameter</para> </entry> <entry> <para>Description</para> </entry> <entry> <para>Type</para> </entry> <entry> <para>Parameter Type</para> </entry> <entry> <para>Required</para> </entry> </row> </thead> <tbody> <row> <entry>job</entry> <entry>The job name.</entry> <entry>string</entry> <entry>path</entry> <entry>Yes</entry> </row> </tbody> </tgroup> </informaltable> </simplesect> <simplesect xml:id="api.jobs.v1_jobs_id_GET.response_data"> <title>Response Data</title> <para> Returns fields available from the <literal>p4 -ztag job</literal> command. For more information, see the <ulink url="http://www.perforce.com/perforce/doc.current/manuals/cmdref/p4_job.html"> <literal>p4 job</literal> command reference. </ulink> </para> <informaltable> <tgroup cols="4"> <colspec colname="parameter" colwidth="*"/> <colspec colname="description" colwidth="4*"/> <colspec colname="type" colwidth="*"/> <colspec colname="required" colwidth="*"/> <thead> <row> <entry> <para>Parameter</para> </entry> <entry> <para>Description</para> </entry> <entry> <para>Type</para> </entry> <entry> <para>Required</para> </entry> </row> </thead> <tbody> <row> <entry><literal>Job</literal></entry> <entry>The job name and primary ID</entry> <entry>string</entry> <entry>Yes</entry> </row> <row> <entry><literal>Status</literal></entry> <entry>The job status, customizable in your system</entry> <entry>string</entry> <entry>Yes</entry> </row> <row> <entry><literal>User</literal></entry> <entry>Perforce login of the current job owner</entry> <entry>string</entry> <entry>Yes</entry> </row> <row> <entry><literal>Description</literal></entry> <entry>The job description, probably contains multiple lines.</entry> <entry>string</entry> <entry>Yes</entry> </row> <row> <entry><literal>Date</literal></entry> <entry>Epoch timestamp when the job was created</entry> <entry>number</entry> <entry>Yes</entry> </row> </tbody> </tgroup> </informaltable> </simplesect> <simplesect xml:id="api.jobs.v1_jobs_id_GET.example"> <title>Example</title> <para> Here is an example request for the job <literal>job000001</literal>. </para> <programlisting> GET /v1/jobs/job000001 HTTP/1.1 Authorization: Basic c3VwZXI6NzcxMmJkMTAtOGQxMi00ZmUwLTgxM2MtZmM2OTExODQ3Yjdj</programlisting> <para> And the typical JSON response: </para> <programlisting language="json"> HTTP/1.1 200 OK Content-Type: application/json { Job: "job000001", Status: "open", User: "super", Date: 1416868098, Description: "You need to get to work mr super " }</programlisting> </simplesect> </section> <section xml:id="api.jobs.v1_jobs_id_PATCH"> <title><literal>PATCH /v1/jobs/[job]</literal></title> <para> Update job specifications. Only the specified parameters in the body will be changed. </para> <para> This method requires authentication. See <link linkend="clientprog.authentication">Perforce Web API Authentication</link> </para> <simplesect xml:id="api.jobs.v1_jobs_id_PATCH.parameters"> <title>Parameters</title> <informaltable> <tgroup cols="5"> <colspec colname="parameter" colwidth="*"/> <colspec colname="description" colwidth="4*"/> <colspec colname="type" colwidth="*"/> <colspec colname="paramtype" colwidth="*" /> <colspec colname="required" colwidth="*"/> <thead> <row> <entry> <para>Parameter</para> </entry> <entry> <para>Description</para> </entry> <entry> <para>Type</para> </entry> <entry> <para>Parameter Type</para> </entry> <entry> <para>Required</para> </entry> </row> </thead> <tbody> <row> <entry><literal>job</literal></entry> <entry>The job name and primary ID</entry> <entry>string</entry> <entry>path</entry> <entry>Yes</entry> </row> <row> <entry><literal>Status</literal></entry> <entry>The job status, customizable in your system</entry> <entry>string</entry> <entry>body</entry> <entry>No</entry> </row> <row> <entry><literal>User</literal></entry> <entry>Perforce login of the current job owner</entry> <entry>string</entry> <entry>body</entry> <entry>No</entry> </row> <row> <entry><literal>Description</literal></entry> <entry>The job description, probably contains multiple lines.</entry> <entry>string</entry> <entry>body</entry> <entry>No</entry> </row> </tbody> </tgroup> </informaltable> </simplesect> <simplesect xml:id="api.jobs.v1_jobs_id_PATCH.example"> <title>Example</title> <para> Here we'll update the status of the existing job <literal >job000002</literal>. </para> <programlisting language="json"> PATCH /v1/jobs/job000002 HTTP/1.1 Authorization: Basic c3VwZXI6NzcxMmJkMTAtOGQxMi00ZmUwLTgxM2MtZmM2OTExODQ3Yjdj Content-Type: application/json { "Status": "closed" }</programlisting> <para> The response will only contain the normal HTTP status information. </para> <programlisting> HTTP/1.1 200 OK</programlisting> </simplesect> </section> <section xml:id="api.jobs.v1_jobs_id_DELETE"> <title><literal>DELETE /v1/jobs/[job]</literal></title> <para> Removes the job specification. </para> <para> This method requires authentication. See <link linkend="clientprog.authentication">Perforce Web API Authentication</link> </para> <simplesect xml:id="api.jobs.v1_jobs_id_DELETE.parameters"> <title>Parameters</title> <informaltable> <tgroup cols="5"> <colspec colname="parameter" colwidth="*"/> <colspec colname="description" colwidth="4*"/> <colspec colname="type" colwidth="*"/> <colspec colname="paramtype" colwidth="*"/> <colspec colname="required" colwidth="*"/> <thead> <row> <entry> <para>Parameter</para> </entry> <entry> <para>Description</para> </entry> <entry> <para>Type</para> </entry> <entry> <para>Parameter Type</para> </entry> <entry> <para>Required</para> </entry> </row> </thead> <tbody> <row> <entry><literal>job</literal></entry> <entry>The job name.</entry> <entry>string</entry> <entry>path</entry> <entry>Yes</entry> </row> </tbody> </tgroup> </informaltable> </simplesect> <simplesect xml:id="api.jobs.v1_jobs_id_DELETE.example"> <title>Example</title> <para> Delete the job <literal>job000002</literal> </para> <programlisting language="json"> DELETE /v1/jobs/job000002 HTTP/1.1 Authorization: Basic c3VwZXI6NzcxMmJkMTAtOGQxMi00ZmUwLTgxM2MtZmM2OTExODQ3Yjdj</programlisting> <para> The response will only contain the normal HTTP status information. </para> <programlisting> HTTP/1.1 200 OK</programlisting> </simplesect> </section> </chapter>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 13972 | tjuricek |
Removing old microservice implementations. The system is now mostly a monolith. Eventually there will be a websocket service. |
||
#1 | 13458 | tjuricek |
Revising P4 Web API docbook documentation to become the Perforce Web Services guide. Right now this is just focused on the Qt SDK. The remaining protocol documentation, etc, will happen eventually. |
||
//guest/perforce_software/helix-web-services/main/p4_web_api/p4_web_api/docbook/xml/methods/jobs.xml | |||||
#1 | 13412 | tjuricek |
Initial version of the web-services mainline. This is a collection of several projects, that will likely often get released together, though many of them may not always be relevant. See the README for more information. |