Dealer Product Assign/Removal OData API

Dealer Product Assign Overview

Our Dealer Product Assignment API provides third-party websites a way to assign products to dealers. 

To create new dealers, use the Dealer Create & Update API.

To create new products, use the Product API.

Possible Response Codes

  • 204 (No Content). The request was successful. The product was assigned to the dealer or the product was already assigned to the dealer.
  • 404 (Not Found). The dealer in the URL was not able to be found.
  • 500 (Internal Server Error). The request was malformed, the product given in the request did not exist, or some other unspecified error occurred when attempting to assign the product to the dealer.

Authentication

The Dealer Product Assign API requires authentication. The HTTP POST will require a valid Authenticate message header with an API token. See the Aimbase Authentication Web Service Specification for more details on how to retrieve a valid API token. 

Authenticate message header example:

Authenticate: Avala-Api {username}:{token}

Post Information

HTTP Endpoint 

https://{baseurl}/odata/V2/Dealers({DealerId})/Products/$ref


Dealer Product Assign Data Schema

Field Name

Required

Format

Description

@odata.id

X

 

The fully qualified odata ID of the product that should be added to the dealer.

 

XML Example Post

POST https://traversebikes.aimbase.com/odata/V2/Dealers(4)/Products/$ref
Content-Type: application/xml
Authenticate: Avala-Api usr:65cd112e-9d39-4d18-987d-306818a35da4:512146

<?xml version="1.0" encoding="UTF-8" ?>
<@odata.id>https://traversebikes.aimbase.com/odata/V2/Products(1)undefined</@odata.id>


JSON Example Post

POST https://traversebikes.aimbase.com/odata/V2/Dealers(4)/Products/$ref
Content-Type: application/json
Authenticate: Avala-Api usr:65cd112e-9d39-4d18-987d-306818a35da4:512146

{
"@odata.id": "https://traversebikes.aimbase.com/odata/V2/Products(1)"
}



Sample Success Response (XML/JSON)

HTTP/1.1 204 No Content



Sample Failed Response (XML/JSON)

<?xml version="1.0" encoding="UTF-8" ?>
<error>
  <code></code>
  <message>An error has occurred.</message>
  <innererror>
    <message>Could not find product with Id: -1</message>
    <type>System.InvalidOperationException</type>
  </innererror>
</error>


{
  "error": {
    "code": "",
    "message": "An error has occurred.",
    "innererror": {
      "message": "Could not find product with Id: -1",
      "type": "System.InvalidOperationException"
    }
  }
}



Dealer Product Removal Overview

Our Dealer Product Assignment API provides third-party websites a way to remove products from dealers.

Possible Response Codes

  • 204 (No Content). The request was successful. The product was removed from dealer or the product was already not already assigned to the dealer.
  • 404 (Not Found). The dealer in the URL was not able to be found.
  • 500 (Internal Server Error). The request was malformed, the product give in the request did not exist, or some other unspecified error occurred when attempting to remove the product to the dealer.

Authentication

The Lead API requires authentication. The HTTP POST will require a valid Authenticate message header with an API token. See the Aimbase Authentication Web Service Specification for more details on how to retrieve a valid API token. 

Authenticate message header example:

Authenticate: Avala-Api {username}:{token}

Post Information

HTTP Endpoint 

https://{baseurl}/odata/V2/Dealers({DealerId})/Products/$ref?$id=https://{baseurl}/odata/V2/Products({ProductId})


Dealer Product Removal Data Schema

Field Name

Required

Format

Description

Note, there is no data content in this request. All Required information is in the request URL.


XML Example Post

DELETE https://traversebikes.aimbase.com/odata/V2/Dealers(4)/Products/$ref?$id=https://traversebikes.aimbase.com/odata/V2/Products(1)
Content-Type: application/xml
Authenticate: Avala-Api usr:65cd112e-9d39-4d18-987d-306818a35da4:512146


JSON Example Post

DELETE https://traversebikes.aimbase.com/odata/V2/Dealers(4)/Products/$ref?$id=https://traversebikes.aimbase.com/odata/V2/Products(1)
Content-Type: application/json
Authenticate: Avala-Api usr:65cd112e-9d39-4d18-987d-306818a35da4:512146


Sample Success Response (XML/JSON)

HTTP/1.1 204 No Content


Sample Failure Response (XML/JSON)

<?xml version="1.0" encoding="UTF-8" ?>
<error>
  <code></code>
  <message>An error has occurred.</message>
  <innererror>
    <message>Could not find product with Id: -1</message>
    <type>System.InvalidOperationException</type>
  </innererror>
</error>

{
  "error": {
    "code": "",
    "message": "An error has occurred.",
    "innererror": {
      "message": "Could not find product with Id: -1",
      "type": "System.InvalidOperationException"
    }
  }
}