{
  "swagger" : "2.0",
  "info" : {
    "description" : "REST API for the  IPC Submission module",
    "version" : "1.0.0",
    "title" : "Submission REST API",
    "termsOfService" : "http://www.ipc.org",
    "contact" : {
      "name" : "IPC",
      "url" : "http://www.ipc.org",
      "email" : "info@ipc.org"
    }
  },
  "tags" : [ {
    "name" : " Solution Provider Submission portal REST endpoints supporting S2S submissions"
  } ],
  "paths" : {
    "/api/submission/s2s" : {
      "post" : {
        "tags" : [ " Solution Provider Submission portal REST endpoints supporting S2S submissions" ],
        "summary" : "Upload and submit a 175x data file",
        "description" : "Upload and submit a 175x data file for the Legal entity that has been used to create the Bearer token, where the 175x data file content bytes are sent as POST request body, returns the submission number to poll/get the submission report.",
        "operationId" : "submit",
        "consumes" : [ "application/xml" ],
        "produces" : [ "application/json", "text/plain", "*/*" ],
        "parameters" : [ {
          "name" : "Content-Type",
          "in" : "header",
          "description" : "The content type header, which is expected to be the 175x content type followed by the filename, e.g. 'application/vnd.175x6.archive; filename=data.xml'",
          "required" : true,
          "type" : "string"
        } ],
        "responses" : {
          "202" : {
            "description" : "The 175x data has been submitted and the response includes its details",
            "schema" : {
              "$ref" : "#/definitions/transactionS2SStatusDto"
            }
          },
          "400" : {
            "description" : "The server cannot process the request due to something that is perceived to be a client error such as malformed request syntax, e.g. Bearer token or request parameters not syntactically correct, Bearer token expired or revoked"
          },
          "401" : {
            "description" : "The call failed the authentication checks"
          },
          "403" : {
            "description" : "The call failed the authorisation checks"
          },
          "404" : {
            "description" : "The service was not found"
          },
          "415" : {
            "description" : "The server refused to accept the request because the payload format is in an unsupported format such as the Content-Type"
          },
          "500" : {
            "description" : "It indicates that the server encountered an unexpected error that prevented it from accepting and processing the request"
          }
        },
        "security" : [ {
          "Bearer" : [ "access" ]
        } ]
      }
    },
    "/api/transaction/s2s/{transactionNumber}" : {
      "get" : {
        "tags" : [ "IPC solution provider API portal REST endpoints supporting S2S transactions" ],
        "summary" : "Retrieve the transaction report for a specific transaction",
        "description" : "Given a transaction number, retrieves transaction report including its status, transaction date, Part itemNumber and validation results.",
        "operationId" : "gettransaction",
        "consumes" : [ "application/json" ],
        "produces" : [ "application/json" ],
        "parameters" : [ {
          "name" : "transactionNumber",
          "in" : "path",
          "description" : "The transaction number to retrieve the relevant transaction report",
          "required" : true,
          "type" : "string"
        } ],
        "responses" : {
          "200" : {
            "description" : "The relevant transaction is found and the response includes its details",
            "schema" : {
              "$ref" : "#/definitions/transactionS2SReport"
            }
          },
          "400" : {
            "description" : "The server cannot process the request due to something that is perceived to be a client error such as malformed request syntax, e.g. Bearer token or request parameters not syntactically correct, Bearer token expired or revoked"
          },
          "401" : {
            "description" : "The call failed the authentication checks"
          },
          "403" : {
            "description" : "The call failed the authorisation checks"
          },
          "404" : {
            "description" : "The service was not found, the transaction information is not found, e.g. wrong transaction number, transaction number belongs to another company"
          },
          "415" : {
            "description" : "The server refused to accept the request because the payload format is in an unsupported format such as the Content-Type"
          },
          "500" : {
            "description" : "It indicates that the server encountered an unexpected error that prevented it from accepting and processing the request"
          }
        },
        "security" : [ {
          "Bearer" : [ "access" ]
        } ]
      }
    }
  },
  "definitions" : {
    "S2SValidationMessage" : {
      "type" : "object",
      "required" : [ "code", "context", "level" ],
      "properties" : {
        "context" : {
          "type" : "string",
          "example" : "175x:ZZZZZZZZZZZZZZZZ-AAAAAAAAAAA",
          "description" : "The validation context, which indicates the path the current validation rule failed requiring from users to fix the reported error",
          "readOnly" : true
        },
        "level" : {
          "type" : "string",
          "example" : "FAIL",
          "description" : "The error level of this validation rule",
          "readOnly" : true,
          "enum" : [ "FAIL indicates that the validation rule results in a transaction with VALIDATION_FAILED status", "WARN indicates that this is a failed 'quality' rule that might trigger further manual checks but not sufficient to fail the transaction", "EXCEPTION indicates that the validation rule could not be executed for technical reasons and as a result of it the transaction remains in a PENDING status (it is expected that it will be fixed in the next application version and the transaction will be resumed automatically without requiring re-transaction from the company)" ]
        },
        "code" : {
          "type" : "string",
          "example" : "BR068",
          "description" : "The identifier of the validation rule that failed",
          "readOnly" : true
        }
      },
      "description" : "A validation entry including detailed information on the validation rule that failed"
    },
    "transactionS2SReport" : {
      "type" : "object",
      "required" : [ "filename", "status", "transactionDate", "transactionNumber", "validations" ],
      "properties" : {
        "status" : {
          "type" : "string",
          "example" : "PENDING",
          "description" : "The transaction status of this transaction",
          "readOnly" : true,
          "enum" : [ "PENDING indicates that the transaction is still being processed by the server", "VALIDATION_SUCCEEDED indicates that the transaction has passed successfully the validation checks (although it may have failed some quality rules) and will be dispatched to the target market areas", "VALIDATION_FAILED indicates that the transaction has failed the validation checks (i.e. at least one transaction rule has failed) and as a result of it the submitted data will not be dispatched to the target market areas." ]
        },
        "filename" : {
          "type" : "string",
          "example" : "Partnumber12345.xml",
          "description" : "The specified 175x data filename during the transaction",
          "readOnly" : true
        },
        "transactionNumber" : {
          "type" : "string",
          "example" : "RMH915785-95",
          "description" : "The transaction number of this transaction",
          "readOnly" : true
        },
        "reportUrl" : {
          "type" : "string",
          "example" : "http://www.ipc.org",
          "description" : "The URL that points to an HTML transaction report page in the  Solution Provider solution provider API portal (requires that a user has logged in first)",
          "readOnly" : true
        },
        "refValue" : {
          "type" : "string",
          "example" : "005056b7-b57b-4ed9-b1ae-c99fb9dec1e7",
          "description" : "The Part itemNumber value",
          "readOnly" : true
        },
        "validations" : {
          "type" : "array",
          "description" : "In case of failed validation checks, this includes a list of identified validation failures (warnings or errors)",
          "readOnly" : true,
          "items" : {
            "$ref" : "#/definitions/S2SValidationMessage"
          }
        },
        "refType" : {
          "type" : "string",
          "description" : "The type of identifier used to correlate this transaction with others/previous transactions for the same part/product, used in case additional transaction types are supported in the future",
          "readOnly" : true,
          "enum" : [ "Part itemNumber" ]
        },
        "transactionDate" : {
          "type" : "string",
          "format" : "date-time",
          "example" : "2019-10-11T10:58:00.726928+03:00",
          "description" : "The creation datetime of this transaction with an offset from UTC/Greenwich in the ISO-8601 calendar system",
          "readOnly" : true
        },
        "dataUuid" : {
          "type" : "string",
          "example" : "anyname.xml",
          "description" : "The submitted 175x data file name",
          "readOnly" : true
        }
      },
      "description" : "The retrieved transaction report given a valid transaction number"
    },
    "transactionS2SStatusDto" : {
      "type" : "object",
      "properties" : {
        "transactionNumber" : {
          "type" : "string",
          "example" : "RMH915785-95",
          "description" : "The transaction number generated upon submitting the provided 175x data file",
          "readOnly" : true
        },
        "statusUrl" : {
          "type" : "string",
          "example" : "http://www.ipc.org",
          "description" : "The URL to retrieve the transaction report through the S2S using the transaction number",
          "readOnly" : true
        },
        "reportUrl" : {
          "type" : "string",
          "example" : "http://www.ipc.org",
          "description" : "The URL that points to a human readable transaction report page in the  Solution Provider solution provider API portal (requires that a user has logged in first)",
          "readOnly" : true
        }
      },
      "description" : "The response generated upon transaction of the provided 175x data file"
    }
  }
}