POST PurchaseContract/PostPurchaseContract

Create a purchase contract

Request Information

URI Parameters

Body Parameters

ClsGrPurConAdd
NameDescriptionTypeAdditional Information
ContractID

ID of the purchase contract

string

Max length: 15

LocationID

ID of the delivery location for the contract

string

Required

Max length: 6

CustomerID

ID of the customer on the contract

string

Required

Max length: 6

CommodityID

ID of the commodity on the contract

string

Required

Max length: 6

DateEstablished

Date the contract was established

string

Required

Format must be MM/dd/yyyy

ContractType

Type of contract

PurchaseContractType

Required

ContractStatus

Current status of the contract

PurchaseContractStatus

Required

CashPrice

Cash price established for the contract

decimal number

Max of 5 decimal places

ContractQuantity

Contracted quantity of the commodity

decimal number

Required

Cannot be negative

BasisPrice

Difference between the futures price and cash price

decimal number

Max of 5 decimal places

FuturesMonthID

ID of the futures month used for the futures price

string

Max length: 10

ExchangeID

ID of the exchange used to establish the price

string

Max length: 10

StrikePrice

Price at which a futures contract can be bought or sold

decimal number

Max of 5 decimal places

ExpireDate

Expiration date of the contract

string

Format must be MM/dd/yyyy

FuturesPrice

Futures price established for the contract

decimal number

Max of 5 decimal places

ContractSigned

Indicates whether or not the contract has been signed

boolean
BidCriteriaID

ID for the terms of the bid

string

Max length: 20

ShippingDestinationID

ID of the shipping destination to apply to the contract

string

Max length: 6

SalespersonID

ID of the salesperson associated with the contract

string

Max length: 15

PricingNotes

Note related to pricing for the contract

string

Max length: 50

PriceByDate

Date by which the contract should be priced or rolled

string

Format must be MM/dd/yyyy

FreightOnBoard

Indicates whether or not the contract includes freight in the established price

boolean
ExternalContractID

Reference ID from another source to be stored with the contract

string

Max length: 50

ContractFormat

The format used to create the physical contract to sign. NOTE: This is required when the database column exists and no defaults are set in Agvance.

string

Max length: 50

DirectShipped

Flag that indicates if the purchase contract is to be treated as direct shipped

boolean
AgvanceUserIdToAssignBuyerSignatureFrom

The Agvance user id to use to assign the buyer signature

string
BuyerSignatureDateSignedToPrint

The date the buyer's signature was applied to the contract (Only used with a valid AgvanceUserIdToAssignBuyerSignatureFrom set)

date
BuyerSignatureDateTimeSignedUtc

The date and time the buyer's signature was captured in UTC (Only used with a valid AgvanceUserIdToAssignBuyerSignatureFrom set)

date
SpotContract

Setting to determine if the purchase contract is a "Spot" type, Priced contract

boolean
FarmId

Farm ID for the contract - free text field

string

Max length: 8

MOTGuid

The Method of Transportation Guid

globally unique identifier
SellerSignatureDateSignedToPrint

The date the seller signed the contract. Only valid when ContractSiigned is true. Only the date portion is used.

date
PurchaseContractComments

List of comments associated with the contract

Collection of ClsGrPurConCommAdd
PurchaseContractDeliveryDates

List of delivery dates for the contract

Collection of ClsGrPurConDdAdd
PurchaseContractSchedules

List of Premium Discount schedules attached to the contract

Collection of ClsGrPurConGfAdd
PurchaseContractMinimumPriceInfo

List of minimum price roll records

Collection of ClsGrPurConRollAdd

Request Formats

application/json, text/json

Sample:
{
  "ContractID": "sample string 1",
  "LocationID": "sample string 2",
  "CustomerID": "sample string 3",
  "CommodityID": "sample string 4",
  "DateEstablished": "sample string 5",
  "ContractType": 1,
  "ContractStatus": 1,
  "CashPrice": 6.1,
  "ContractQuantity": 7.1,
  "BasisPrice": 8.1,
  "FuturesMonthID": "sample string 9",
  "ExchangeID": "sample string 10",
  "StrikePrice": 11.1,
  "ExpireDate": "sample string 12",
  "FuturesPrice": 13.1,
  "ContractSigned": true,
  "BidCriteriaID": "sample string 15",
  "ShippingDestinationID": "sample string 16",
  "SalespersonID": "sample string 17",
  "PricingNotes": "sample string 18",
  "PriceByDate": "sample string 19",
  "FreightOnBoard": true,
  "ExternalContractID": "sample string 21",
  "ContractFormat": "sample string 22",
  "DirectShipped": true,
  "AgvanceUserIdToAssignBuyerSignatureFrom": "sample string 24",
  "BuyerSignatureDateSignedToPrint": "2024-11-21T09:50:02.3689738+00:00",
  "BuyerSignatureDateTimeSignedUtc": "2024-11-21T09:50:02.3689738+00:00",
  "SpotContract": true,
  "FarmId": "sample string 26",
  "MOTGuid": "cd1af62f-f349-466d-8875-6ed676ade48b",
  "SellerSignatureDateSignedToPrint": "2024-11-21T09:50:02.3689738+00:00",
  "PurchaseContractComments": [
    {
      "Comment": "sample string 1"
    },
    {
      "Comment": "sample string 1"
    }
  ],
  "PurchaseContractDeliveryDates": [
    {
      "StartDate": "sample string 1",
      "CompleteDate": "sample string 2",
      "Quantity": 3.1
    },
    {
      "StartDate": "sample string 1",
      "CompleteDate": "sample string 2",
      "Quantity": 3.1
    }
  ],
  "PurchaseContractSchedules": [
    {
      "PremiumDiscountGuid": "95b90ce0-001b-4e32-9d65-361603c1f742",
      "GradFactorId": "sample string 1",
      "ScheduleId": "sample string 2"
    },
    {
      "PremiumDiscountGuid": "95b90ce0-001b-4e32-9d65-361603c1f742",
      "GradFactorId": "sample string 1",
      "ScheduleId": "sample string 2"
    }
  ],
  "PurchaseContractMinimumPriceInfo": [
    {
      "FuturesPrice": 1.1,
      "BasisPrice": 2.1,
      "BuyOptionPrice": 3.1,
      "BuyOptionMonth": "sample string 4",
      "BuyOptionPorC": "sample string 5",
      "BuyOptionStrike": 6.1,
      "SellOptionPrice": 7.1,
      "SellOptionMonth": "sample string 8",
      "SellOptionPorC": "sample string 9",
      "SellOptionStrike": 10.1,
      "Storage": 11.1,
      "ServiceCharge": 12.1,
      "MinimumPrice": 13.1,
      "ExpirationDate": "2024-11-21T09:50:02.3699735+00:00",
      "Comments": "sample string 14"
    },
    {
      "FuturesPrice": 1.1,
      "BasisPrice": 2.1,
      "BuyOptionPrice": 3.1,
      "BuyOptionMonth": "sample string 4",
      "BuyOptionPorC": "sample string 5",
      "BuyOptionStrike": 6.1,
      "SellOptionPrice": 7.1,
      "SellOptionMonth": "sample string 8",
      "SellOptionPorC": "sample string 9",
      "SellOptionStrike": 10.1,
      "Storage": 11.1,
      "ServiceCharge": 12.1,
      "MinimumPrice": 13.1,
      "ExpirationDate": "2024-11-21T09:50:02.3699735+00:00",
      "Comments": "sample string 14"
    }
  ]
}

application/xml, text/xml

Sample:
<ClsGrPurCon.ClsGrPurConAdd xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/SKY.Core.Grain">
  <AgvanceUserIdToAssignBuyerSignatureFrom>sample string 24</AgvanceUserIdToAssignBuyerSignatureFrom>
  <BasisPrice>8.1</BasisPrice>
  <BidCriteriaID>sample string 15</BidCriteriaID>
  <BuyerSignatureDateSignedToPrint>2024-11-21T09:50:02.3689738+00:00</BuyerSignatureDateSignedToPrint>
  <BuyerSignatureDateTimeSignedUtc>2024-11-21T09:50:02.3689738+00:00</BuyerSignatureDateTimeSignedUtc>
  <CashPrice>6.1</CashPrice>
  <CommodityID>sample string 4</CommodityID>
  <ContractFormat>sample string 22</ContractFormat>
  <ContractID>sample string 1</ContractID>
  <ContractQuantity>7.1</ContractQuantity>
  <ContractSigned>true</ContractSigned>
  <ContractStatus>Open</ContractStatus>
  <ContractType>Priced</ContractType>
  <CustomerID>sample string 3</CustomerID>
  <DateEstablished>sample string 5</DateEstablished>
  <DirectShipped>true</DirectShipped>
  <ExchangeID>sample string 10</ExchangeID>
  <ExpireDate>sample string 12</ExpireDate>
  <ExternalContractID>sample string 21</ExternalContractID>
  <FarmId>sample string 26</FarmId>
  <FreightOnBoard>true</FreightOnBoard>
  <FuturesMonthID>sample string 9</FuturesMonthID>
  <FuturesPrice>13.1</FuturesPrice>
  <LocationID>sample string 2</LocationID>
  <MOTGuid>cd1af62f-f349-466d-8875-6ed676ade48b</MOTGuid>
  <PriceByDate>sample string 19</PriceByDate>
  <PricingNotes>sample string 18</PricingNotes>
  <PurchaseContractComments>
    <ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConCommAdd>
      <Comment>sample string 1</Comment>
    </ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConCommAdd>
    <ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConCommAdd>
      <Comment>sample string 1</Comment>
    </ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConCommAdd>
  </PurchaseContractComments>
  <PurchaseContractDeliveryDates>
    <ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConDdAdd>
      <CompleteDate>sample string 2</CompleteDate>
      <Quantity>3.1</Quantity>
      <StartDate>sample string 1</StartDate>
    </ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConDdAdd>
    <ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConDdAdd>
      <CompleteDate>sample string 2</CompleteDate>
      <Quantity>3.1</Quantity>
      <StartDate>sample string 1</StartDate>
    </ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConDdAdd>
  </PurchaseContractDeliveryDates>
  <PurchaseContractMinimumPriceInfo>
    <ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConRollAdd>
      <BasisPrice>2.1</BasisPrice>
      <BuyOptionMonth>sample string 4</BuyOptionMonth>
      <BuyOptionPorC>sample string 5</BuyOptionPorC>
      <BuyOptionPrice>3.1</BuyOptionPrice>
      <BuyOptionStrike>6.1</BuyOptionStrike>
      <Comments>sample string 14</Comments>
      <ExpirationDate>2024-11-21T09:50:02.3699735+00:00</ExpirationDate>
      <FuturesPrice>1.1</FuturesPrice>
      <MinimumPrice>13.1</MinimumPrice>
      <SellOptionMonth>sample string 8</SellOptionMonth>
      <SellOptionPorC>sample string 9</SellOptionPorC>
      <SellOptionPrice>7.1</SellOptionPrice>
      <SellOptionStrike>10.1</SellOptionStrike>
      <ServiceCharge>12.1</ServiceCharge>
      <Storage>11.1</Storage>
    </ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConRollAdd>
    <ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConRollAdd>
      <BasisPrice>2.1</BasisPrice>
      <BuyOptionMonth>sample string 4</BuyOptionMonth>
      <BuyOptionPorC>sample string 5</BuyOptionPorC>
      <BuyOptionPrice>3.1</BuyOptionPrice>
      <BuyOptionStrike>6.1</BuyOptionStrike>
      <Comments>sample string 14</Comments>
      <ExpirationDate>2024-11-21T09:50:02.3699735+00:00</ExpirationDate>
      <FuturesPrice>1.1</FuturesPrice>
      <MinimumPrice>13.1</MinimumPrice>
      <SellOptionMonth>sample string 8</SellOptionMonth>
      <SellOptionPorC>sample string 9</SellOptionPorC>
      <SellOptionPrice>7.1</SellOptionPrice>
      <SellOptionStrike>10.1</SellOptionStrike>
      <ServiceCharge>12.1</ServiceCharge>
      <Storage>11.1</Storage>
    </ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConRollAdd>
  </PurchaseContractMinimumPriceInfo>
  <PurchaseContractSchedules>
    <ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConGfAdd>
      <GradFactorId>sample string 1</GradFactorId>
      <PremiumDiscountGuid>95b90ce0-001b-4e32-9d65-361603c1f742</PremiumDiscountGuid>
      <ScheduleId>sample string 2</ScheduleId>
    </ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConGfAdd>
    <ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConGfAdd>
      <GradFactorId>sample string 1</GradFactorId>
      <PremiumDiscountGuid>95b90ce0-001b-4e32-9d65-361603c1f742</PremiumDiscountGuid>
      <ScheduleId>sample string 2</ScheduleId>
    </ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConGfAdd>
  </PurchaseContractSchedules>
  <SalespersonID>sample string 17</SalespersonID>
  <SellerSignatureDateSignedToPrint>2024-11-21T09:50:02.3689738+00:00</SellerSignatureDateSignedToPrint>
  <ShippingDestinationID>sample string 16</ShippingDestinationID>
  <SpotContract>true</SpotContract>
  <StrikePrice>11.1</StrikePrice>
</ClsGrPurCon.ClsGrPurConAdd>

application/x-www-form-urlencoded

Sample:

Failed to generate the sample for media type 'application/x-www-form-urlencoded'. Cannot use formatter 'JQueryMvcFormUrlEncodedFormatter' to write type 'ClsGrPurConAdd'.

Response Information

Resource Description

Create a purchase contract

AgvPurchaseContractDetails
NameDescriptionTypeAdditional Information
Status

0 - Success; 1 - An error occurred; 2 - An error occurred; 3 - Descriptive message, process was successful

string
Message

Informational message that corresponds to the Status returned; 0 - Message will be "OK"; 1 - Detailed message returned to give user an indication of what went wrong; 2 - Less detailed message returned that may not mean anything to the user but that the application might use to take a corrective action; 3 - Not an error but something the user might need to know

string
Count

The number of results returned.

string
PurchaseContract

ClsGrPurCon

Response Formats

application/json, text/json

Sample:
{
  "Status": "sample string 1",
  "Message": "sample string 2",
  "Count": "1",
  "PurchaseContract": {
    "Contract": "sample string 1",
    "CustID": "sample string 2",
    "Location": "sample string 3",
    "Commodity": "sample string 4",
    "Dateest": "sample string 5",
    "ExpireDate": "sample string 6",
    "ContractStatus": "sample string 7",
    "ContractType": "sample string 8",
    "CashPrice": 9.1,
    "ContractQuantity": 10.1,
    "QuantityRecvd": 11.1,
    "Basisprice": 12.1,
    "FuturesMonth": "sample string 13",
    "Exchange": "sample string 15",
    "StrikePrice": 16.1,
    "Futuresprice": 17.1,
    "ContractSigned": true,
    "BidCriteria": "sample string 19",
    "ShipDestination": "sample string 20",
    "OriginContract": "sample string 21",
    "OriginLocation": "sample string 22",
    "SalesmanID": "sample string 23",
    "PricingNotes": "sample string 24",
    "IsSpot": true,
    "originalContractQuantity": 26.1,
    "PurchaseContractGuid": "0502aefb-456c-40fa-b1f0-9bb48b6bbb8f",
    "SellerSignatureDateSignedToPrint": "2024-11-21T09:50:02.4089734+00:00",
    "ContractFormat": "sample string 35",
    "DirectShipped": true,
    "LastModifiedUTC": "2024-11-21T09:50:02.4089734+00:00",
    "PurchaseContractDeliveryDates": [
      {
        "Contract": "sample string 1",
        "Location": "sample string 2",
        "Lineitem": "3",
        "StartDate": "sample string 4",
        "Quantity": "5.1",
        "CompleteDate": "sample string 6"
      },
      {
        "Contract": "sample string 1",
        "Location": "sample string 2",
        "Lineitem": "3",
        "StartDate": "sample string 4",
        "Quantity": "5.1",
        "CompleteDate": "sample string 6"
      }
    ],
    "PurchaseContractGradeFactors": [
      {
        "Contract": "sample string 1",
        "Location": "sample string 2",
        "Lineitem": "3",
        "GradFact": "sample string 4",
        "Schedule": "sample string 5",
        "Commodity": "sample string 6"
      },
      {
        "Contract": "sample string 1",
        "Location": "sample string 2",
        "Lineitem": "3",
        "GradFact": "sample string 4",
        "Schedule": "sample string 5",
        "Commodity": "sample string 6"
      }
    ],
    "PurchaseContractComments": [
      {
        "CommentDate": "sample string 4",
        "Comment": "sample string 5"
      },
      {
        "CommentDate": "sample string 4",
        "Comment": "sample string 5"
      }
    ]
  }
}

application/xml

Sample:

An exception has occurred while using the formatter 'XmlMediaTypeFormatter' to generate sample for media type 'application/xml'. Exception message: No set method for property 'QuantityAsStringForApi' in type 'SKY.Core.Grain.ClsGrPurCon+ClsGrPurConDd'.

text/xml

Sample:

An exception has occurred while using the formatter 'XmlMediaTypeFormatter' to generate sample for media type 'text/xml'. Exception message: No set method for property 'QuantityAsStringForApi' in type 'SKY.Core.Grain.ClsGrPurCon+ClsGrPurConDd'.