"Schedule Pipeline" API endpoint missing required information

XMLWordPrintable

    • 1
    • Severity 3 - Minor
    • 12

      Issue Summary

      POST API endpoint for “Create a schedule” is missing information about required fields. Please update the documentation to ensure that all information necessary to complete the call is included.

      This is reproducible on Data Center: (yes) / (no)

      Steps to Reproduce

      1. Attempt "POST" call to API with documented JSON example
      2. Encounter error due to missing field(s)

      Expected Results

      Successful pipeline schedule creation

      Actual Results

      Using a data payload of:

        --data '{
        "type": "<string>",
        "target": {
          "selector": {
            "type": "<string>"
          },
          "ref_name": "<string>",
          "ref_type": "branch"
        },
        "enabled": true,
        "cron_pattern": "<string>"
      }'
      

      Will cause you to encounter the following error:

      {"error": {"message": "An invalid field was found in the JSON payload.", "fields": ["target"], "detail": "Could not resolve subtype of [simple type, class com.atlassian.pipelines.rest.model.v1.pipeline.targetref.ReferenceTargetModel]: missing type id property 'type' (for POJO property 'target')\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 133] (through reference chain: com.atlassian.pipelines.rest.model.v1.schedule.ImmutableScheduleModel$Builder[\"target\"])", "data": {"key": "rest-service.request.invalid-json"}}}
      

      Workaround

      1. Add the field "target.type" and set it specifically to the string "pipeline_ref_target"
      2. Specifically set the field "target.selector.type" to the string "custom"

      Example:

        --data '{
        "type": "<string>",
        "target": {
          "selector": {
            "type": "custom"
          },
          "type": "pipeline_ref_target"
          "ref_name": "<string>",
          "ref_type": "branch"
        },
        "enabled": true,
        "cron_pattern": "<string>"
      }'
      

      Note:
      There may be other options for the string inputs of both fields but these need to be discovered by Dev and added to the documentation.

            Assignee:
            Unassigned
            Reporter:
            Michael Walker (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: