Skip to content

Schedule a job

Open .md

PUT/v2/api/store/{team_slug}/v2/job/{hash_id}/update_prod_date

v2Operation ID v2_public_job_update_prod_date

Sets, moves or clears a job's production start and due dates. Returns the job, with every task's new dates, and a top-level previous_schedule next to data: the job and task dates as they were before the call.

  • To schedule or move, send both dates. If every dated task still fits inside the new dates, the tasks stay where they are. Otherwise all dated tasks shift together so the earliest starts at the new start_date; a task start that would fall before the new start_date is set to it, a task due date that would fall after the new due_date is set to it, and a dated task without a due date gets the new due date.
  • To unschedule, send both as null. Every task of the job loses its dates too. To undo, the web app sends the previous_schedule back to its restore call, which is not on the public API, so keep that value if you may need it.

Always send both keys: leaving both out ({}) is the same as sending both null, and unschedules the job.

Permission

Any member of the team; this route checks no sales order permission.

Business rules

  • Send both dates, or both as null. One null and the other set is a 422 job_validation_error: "Invalid date range. Both start/due dates should either be set or null." Sending only one of the two keys is a 422 validation_failed.
  • start_date after due_date is a 422 job_validation_error: "Invalid date range. Due Date should be greater than Start Date."
  • Leaving both keys out is the same as sending both null: it unschedules the job and clears every task's dates.

Side effects

  • Moves the job's dated tasks when they no longer fit the new dates (see above), or clears every task's dates when you unschedule.
  • Open Admin Portal calendars and boards refresh.

Path parameters

  • team_slugstringrequired

    Your team slug, shown as Team ID next to your API key in Profile.

    • Example your-team
  • hash_idstringrequired

    The job's hash id (id). Hash ids only: a unique key or a document number gives 404.

    • Example WaGvtaWsx7Kcn4

Query parameters

  • Optional. 1 (or true, yes, on) makes the answer smaller: each mockup and production file's current_approval leaves out its items list, and every other key stays as it is. The job's pending_approval and webhook payloads keep their items. Every file repeats its approval with all of its items, so a job with many files on one approval answers with far less data this way; read approval items from the approvals operations instead. Left out (or any other value), the answer is unchanged. Only the query string is read: a body field with this name is ignored.

    • Example 1

Request body

application/json, required.

  • due_datestring (date-time) | nullrequired

    The production due date (an ISO 8601 date or date-time), or null to unschedule. Not before start_date.

  • start_datestring (date-time) | nullrequired

    The production start (an ISO 8601 date or date-time), or null to unschedule.

More examples (1)

Unschedule

curl
curl -X PUT 'https://secure.yoprint.com/v2/api/store/your-team/v2/job/WaGvtaWsx7Kcn4/update_prod_date' \  -H 'Authorization: Bearer YOUR_API_KEY' \  -H 'Accept: application/json' \  -H 'X-Yoprint-Decimal-Format: exact-v1' \  -H 'Content-Type: application/json' \  -d '{    "due_date": null,    "start_date": null  }'

Response

200Successful response.

  • dataobjectrequired

    A job.

    Child fields (43)
    • assigned_usersarray of objects

      People on the job.

      Fields of each item (3)
    • auto_saved_forstring | null

      Set only on autosave copies.

    • customerobject
      Child fields (2)
      • idstring | null

        The customer.

      • namestring | null
    • due_datestring (date-time) | null

      Production due date. ISO 8601 with offset, or null.

    • Kept for older clients; not a count of services.

    • idstring

      The job.

    • impression_countnumber | null
    • inventory_statusstring | null

      The stock status of the job's lines.

    • is_rushboolean
    • item_countnumber | null

      Units on the job.

    • location_countnumber | null
    • mockuparray of objects

      Mockup files.

      Fields of each item (3)
      • idstring

        The file.

      • namestring | null
      • urlstring | null

        Download link with its own access token.

    • Child fields (2)
    • namestring | null
    • need_cust_provide_productboolean | integer | null

      Blanks are provided by the customer.

    • notestring | null
    • order_idstring

      The order.

    • The order number.

    • pdfarray of objects

      PDF links.

      Fields of each item (2)
      • labelstring
      • urlstring (uri)

        A download link that carries its own long-lived access token: don't publish it.

    • The open approval request, if any.

    • pipelinesarray of objects

      The job's tasks.

      Fields of each item (24)
      • assigned_usersarray of objects

        Who is assigned.

      • created_atstring (date-time)
      • due_datestring (date-time) | null

        Task due date. ISO 8601 with offset, or null.

      • idstring

        The task.

      • job_idstring

        The job.

      • job_is_rushboolean | integer | null
      • job_item_countnumber | null
      • job_namestring | null
      • The job number with its prefix.

      • job_status_idstring | null

        The job's current status.

      • namestring
      • notestring | null
      • order_idstring

        The order.

      • order_namestring | null
      • order_scoped_idstring | null

        The order number.

      • The task preset it comes from.

      • positioninteger

        Order among tasks; lower comes first. 0 when unset.

      • A summary of the job's order.

        Child fields (14)
      • start_datestring (date-time) | null

        Task start. ISO 8601 with offset, or null.

      • statusobject

        A status: label, kind and place in the list.

        Child fields (9)
        • colorstring | null

          Hex color.

        • idstring

          The status.

        • labelstring
        • Only on the statuses of a task preset (role pipeline): the task preset. Absent on other statuses.

        • positioninteger

          Its place in the team's list: sort by it to find the next status.

        • rolestring

          Which list it belongs to: job for job statuses, pipeline for the statuses of a task preset.

          • One of: "order", "quote", "job", "purchase_order", "shipment", "customer_message", "pipeline"
        • trashedboolean

          The status was deleted.

        • typestring

          The kind of status: start (Pending), pre_production and in_progress (In Progress), end (Completed).

          • One of: "start", "pre_production", "in_progress", "end"
      • status_completion_datestring (date-time) | null

        When it reached a Completed status. ISO 8601 with offset, or null.

      • status_idstring

        The task's status (a status of its task preset).

      • status_last_change_datestring (date-time) | null

        When the status last changed. ISO 8601 with offset, or null.

      • updated_atstring (date-time)
    • positioninteger | null
    • The job's price before pricing rules, at the stored scale. A decimal pair: the amount is value ÷ 10^dp ({ "value": 1250, "dp": 2 } is 12.50). Read dp every time: it can differ between fields and records.

    • The pricing rule that set the job's decoration price, or null. These answers usually carry only type, the two ids and the two totals. List the jobs of a sales order or quote and Get one job of a sales order or quote answer with the full summary (the rule's current name and position, the prices before and after).

      Child fields (12)
      • afterstring | null

        Full summary only: the price after the rule, as a decimal string.

      • after_totaldecimal pair

        The decoration price after the rule. A decimal pair: the amount is value ÷ 10^dp ({ "value": 1250, "dp": 2 } is 12.50). Read dp every time: it can differ between fields and records.

      • basestring | null

        Full summary only: the decoration price the rule started from, as a decimal string.

      • base_typestring | null

        Full summary only: service_price.

      • normal_pricestring | null

        Full summary only: the price with no rule (the same as base for a job).

      • original_totaldecimal pair

        The decoration price before the rule. A decimal pair: the amount is value ÷ 10^dp ({ "value": 1250, "dp": 2 } is 12.50). Read dp every time: it can differ between fields and records.

      • pricing_group_idstring | null

        The pricing group.

      • pricing_group_namestring | null

        Full summary only: the group's name now.

      • pricing_group_removedboolean | null

        Full summary only: true when the group was removed since. The job keeps its price.

      • pricing_rule_idstring | null

        The pricing rule.

      • ruleobject | null

        Full summary only: the rule as the group holds it now (id, label, position, where 1 is the first rule checked), or null when it no longer exists.

      • typestring | null

        service on a job.

    • pricing_totaldecimal pair

      The job's price, at the stored scale (usually 6 decimal places: { "value": 600000000, "dp": 6 } is 600.00). A decimal pair: the amount is value ÷ 10^dp ({ "value": 1250, "dp": 2 } is 12.50). Read dp every time: it can differ between fields and records.

    • production_filearray of objects

      Production files.

    • qr_code_urlstring | null

      A QR code image for the job.

    • A summary of the job's order.

      Child fields (14)
      • created_bystring | null

        Who created the order.

      • cust_due_datestring (date-time) | null

        Order customer due (in-hand) date. ISO 8601 with offset, or null.

      • due_datestring (date-time) | null

        Order production due date. ISO 8601 with offset, or null.

      • external_typestring | null

        shopify when the order came from Shopify, else null.

      • is_quoteboolean
      • is_rushboolean
      • issue_datestring (date-time) | null

        Order issue date. ISO 8601 with offset, or null.

      • namestring | null

        Order name.

      • object_typestring | null

        sales_order or quote.

      • ship_due_datestring (date-time) | null

        Order ship-by date. ISO 8601 with offset, or null.

      • shopify_deleted_externally_atstring (date-time) | null

        When it was deleted in Shopify. ISO 8601 with offset, or null.

      • start_datestring (date-time) | null

        Order production start. ISO 8601 with offset, or null.

      • status_idstring | null

        The order status.

    • scoped_idstring

      The job number as shown, with its JOB- prefix. Change a job number takes only the digits.

    • servicesarray of objects

      The services (decorations).

      Fields of each item (9)
    • start_datestring (date-time) | null

      Production start. ISO 8601 with offset, or null.

    • statusobject

      A status: label, kind and place in the list.

    • status_completion_datestring (date-time) | null

      When it reached a Completed status. ISO 8601 with offset, or null.

    • status_idstring

      The job's current status: its production stage. Look it up in List job statuses, or read status.

    • status_last_change_datestring (date-time) | null

      When the status last changed. ISO 8601 with offset, or null.

    • Quantity that still needs ordering, with 8 decimal places ("12.00000000"). A decimal string, such as "0.00000000"; parse it as a decimal.

    • unique_keystring | null

      The job's unique key.

    • versioninteger
  • previous_scheduleobjectrequired

    The job and task dates as they were before this request. Send it unchanged to restore_schedule to undo an unschedule.

    Child fields (4)
    • due_datestring (date-time) | nullrequired
    • job_idstringrequired
    • start_datestring (date-time) | nullrequired
    • tasksarray of objectsrequired
      Fields of each item (3)
      • due_datestring (date-time) | nullrequired
      • idstringrequired
      • start_datestring (date-time) | nullrequired
  • statusintegerrequired
  • successbooleanrequired

Errors

  • 401The API key is missing or wrong (unauthenticated).

  • 403You are not allowed to do this. api_access_not_in_plan: your team's plan doesn't include API access (Pro and above, with an active subscription or trial), so every request answers this until the team upgrades. When your role lacks the permission the operation needs, the body is only {"message": "Insufficient Permission"}. Other refusals use the error envelope, with unauthorized or user_is_not_authorized.

  • 404Not found. page_not_found: the team slug is unknown, you are not a member of the team, or an id in the path is not one of this team's. code: null, with a message that starts "No query results for": there is no record with that id.

    When
    The job isn't your team's, or its order is an old (version 1) order. Jobs on quotes work too.
    Fix
    Check the job id.
  • 422The request was refused and changed nothing. validation_failed lists what to fix in error.fields; other codes name a business rule, explained in error.message. A few checks answer with only {"message": "..."}. An operation that calls another service (a payment provider, a carrier, an accounting app) can answer connect_timeout ("Please retry again") when that service does not answer in time: the change may or may not have happened there, so read the record back before you retry.

    When
    Only one of the two keys is sent, or a date isn't ISO 8601 (validation_failed, details in error.fields).
    Fix
    Send both keys, as ISO 8601 date-times or null.
    When
    One date is null and the other set, or the start is after the due date (job_validation_error).
    Fix
    Send both dates in order, or both null.