Add a Document via Direct Upload

Directly uploading a file for you port order is a two step operation; first you will request a storage location from the Flowroute Servers. This is a time sensitive URL located in Amazon's S3 storage facility.

Next you will use a PUT method to upload your file to the specified URL.

Your document is encrypted during transmission and at rest when it reaches its final destination.

Method

POST portorders/:portorder_id/upload_file

Body Parameters

  • filename
    string Required

    The full path to the file to be uploaded.

Response Fields

On success, the HTTP status code in the response header is 200 OK and the response body contains information on the document request. On error, the header status code is an error code and the response body contains an array of error objects.

  • data
    object

    Document request object composed of the following:

    • attributes
      object

      Object composed of attributes relating to the state of the request.

      • url
        string

        The time sensitive document upload URL.

      • expires
        string

        The time that the document upload URL expires.

  • id
    integer

    ID assigned to the document process.

  • links
    object

    Links object pointing to the status for this document.

    For example, https://...portorders/394822/files/99999.

  • type
    string

    This will always be portorder-file-url.

Upload the File

Now that we have the S3 URL, it's time to upload the file. Next you will use a PUT method to upload your file to the specified URL.

Your document is encrypted during transmission and at rest when it reaches its final destination.

Method

PUT

Body

  • bytes Required

    The binary data to be uploaded.


Response Fields

On success, the HTTP status code in the response header is 200 OK and the response body will be empty. On error, the header status code is an error code and the response body contains an XML error document.

Step 1

Example Request

            
POST /v2/portorders/:portorder_id/upload_file HTTP/1.1
Content-Type: application/json
Accept: application/json

{
    "filename": "/fullpath/to/mybill.pdf"
}
            
          

Example Response

Success

200 OK

            
{
    "data": {
        "attributes": {
            "expires": "2018-07-31T21:34:17.576092+00:00",
            "url": "https://porting-uploads-staging.s3.amazonaws.com/4/40093/bc3fd888-55af-569b-84fb-bfa19810578d/test.pdf?AWSAccessKeyId=ASIAJHBFNLMGW4TZWKSA&content-type;=application%2Fpdf&Expires;=1533072857&x-amz-security-token;=FQoDYXdzEDUaDBSPWJQDOsBj5epBFSKZBIJCbivrhJZQUviBdNiZMoCl2kz8gBrJJGqYjdsj%2BfV9gd8ij310fAonU5MbSMjRW3LabrpQSOdBQwVFiSaxMPGP7MhV0KopybSWgdbpgb58RPCuFGThpkIA2al2GvenKaJTLZx2KO62h%2BhsmroMkx7GwnY7u3mx2122oJJ%2FnB7faIrxmdwLgKKDzI%2BRy6GWTAWs302SD0fWXiS21XQiniFl1%2F1SkScFVd4sOKNTyeyECOmXBme82c1Kqm1yEG9EKDrCO9wbzaQE32Fg0yZPIg9c66akU2mWpF9vbN5OEfrvN5sc4KoAoY5zGVEfMwP6OSt17X5BMLtceCCQxADk%2B6oxGriubg%2BhPvXGvg5%2FygeP7DXKEgKiK1P3t2bmtTHJswa8%2FgALRVEOzbOhZgCBi9e7MEocp8LKq%2FwCBPRnG39dqcVhbukRZX05a1hXeAi9MABaS7IUjocKPekQGmruOseUazRAnllwLyMhRoRJkuMGW7RhQ8JyClgzyKt0B0hW0ClgH6BkYhxq42f3X%2BPoMWIX6E6pR%2Fj6xyTXKmaabt2wN%2BXV7fpbUBJJMQ%2BdFRKHfXbDqPD4l7%2BfS%2FKegXLz%2BdL5RGJSorU59%2B86dEf5Wj27cXeNUOJe9BMd2EUVeoAouOJv0vN3QzRVARRNvySPqYLyo7FwpcwR43KLOc0dc63ZAJOEwMwnsKi7hWEsVTlDNZgHtqqQ05IoXiix%2B4LbBQ%3D%3D&Signature;=MkGYkKFPc%2BjU7HG0qbCfmfJVors%3D"
        },
        "id": "50987",
        "links": {
            "self": "https://api.flowroute.com/v2/portorders/40093/files/50987"
        },
        "type": "portorder-file-url"
    }
}
            
          

Step 2

Example Request

            
PUT S3_URL HTTP/1.1
Content-Type: application/pdf

bytes
            
          

Example Response

Success

200 OK

Error

401 UNAUTHORIZED

            
<?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>AccessDenied</Code>
  <Message>Request has expired</Message>
  <Expires>2018-07-31T21:34:17Z</Expires>
  <ServerTime>2018-07-31T21:59:53Z</ServerTime>
  <RequestId>DE165F72257E13D8</RequestId>
  <HostId>sR9Nd3c8C9DARSHQfpSaIp24BRRqRz2QkaYJYpxCwyMpa3RycZXA7gorfZEkAnvbpE0ahO47ZYI=</HostId>
</Error>
            
          

Step 1

Example Request

            
curl -X POST https://api.flowroute.com/v2/portorders/:portorder_id/upload_file \
    -u accessKey:secretKey -H "Content-Type: application/json" \
    -d '{"filename": "/path/to/filename.pdf"}'
            
          

Example Response

Success

200 OK

            
{
    "data": {
        "attributes": {
            "expires": "2018-07-31T21:34:17.576092+00:00",
            "url": "https://porting-uploads-staging.s3.amazonaws.com/4/40093/bc3fd888-55af-569b-84fb-bfa19810578d/test.pdf?AWSAccessKeyId=ASIAJHBFNLMGW4TZWKSA&content-type;=application%2Fpdf&Expires;=1533072857&x-amz-security-token;=FQoDYXdzEDUaDBSPWJQDOsBj5epBFSKZBIJCbivrhJZQUviBdNiZMoCl2kz8gBrJJGqYjdsj%2BfV9gd8ij310fAonU5MbSMjRW3LabrpQSOdBQwVFiSaxMPGP7MhV0KopybSWgdbpgb58RPCuFGThpkIA2al2GvenKaJTLZx2KO62h%2BhsmroMkx7GwnY7u3mx2122oJJ%2FnB7faIrxmdwLgKKDzI%2BRy6GWTAWs302SD0fWXiS21XQiniFl1%2F1SkScFVd4sOKNTyeyECOmXBme82c1Kqm1yEG9EKDrCO9wbzaQE32Fg0yZPIg9c66akU2mWpF9vbN5OEfrvN5sc4KoAoY5zGVEfMwP6OSt17X5BMLtceCCQxADk%2B6oxGriubg%2BhPvXGvg5%2FygeP7DXKEgKiK1P3t2bmtTHJswa8%2FgALRVEOzbOhZgCBi9e7MEocp8LKq%2FwCBPRnG39dqcVhbukRZX05a1hXeAi9MABaS7IUjocKPekQGmruOseUazRAnllwLyMhRoRJkuMGW7RhQ8JyClgzyKt0B0hW0ClgH6BkYhxq42f3X%2BPoMWIX6E6pR%2Fj6xyTXKmaabt2wN%2BXV7fpbUBJJMQ%2BdFRKHfXbDqPD4l7%2BfS%2FKegXLz%2BdL5RGJSorU59%2B86dEf5Wj27cXeNUOJe9BMd2EUVeoAouOJv0vN3QzRVARRNvySPqYLyo7FwpcwR43KLOc0dc63ZAJOEwMwnsKi7hWEsVTlDNZgHtqqQ05IoXiix%2B4LbBQ%3D%3D&Signature;=MkGYkKFPc%2BjU7HG0qbCfmfJVors%3D"
        },
        "id": "50987",
        "links": {
            "self": "https://api.flowroute.com/v2/portorders/40093/files/50987"
        },
        "type": "portorder-file-url"
    }
}
            
          

Step 2

Example Request

            
curl -X PUT -T /path/to/filename.pdf -H "Content-Type: application/pdf" S3_URL
            
          

Success

200 OK

Error

401 UNAUTHORIZED

            
<?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>AccessDenied</Code>
  <Message>Request has expired</Message>
  <Expires>2018-07-31T21:34:17Z</Expires>
  <ServerTime>2018-07-31T21:59:53Z</ServerTime>
  <RequestId>DE165F72257E13D8</RequestId>
  <HostId>sR9Nd3c8C9DARSHQfpSaIp24BRRqRz2QkaYJYpxCwyMpa3RycZXA7gorfZEkAnvbpE0ahO47ZYI=</HostId>
</Error>