1. Home
  2. Knowledge Base
  3. REST API
  4. Order Services
  5. Pulling Profit And Loss Information in Bulk

Pulling Profit And Loss Information in Bulk

Overview

In order to get information about profit and loss for multiple orders, you can consume the endpoint presented in this article. In order to consume it, you must:

  • Be authenticated user

For information on how you can authenticate, see: Authentication

As soon as you do authentication and receive a valid token, it needs to be passed on every call to the server.

Endpoint

Example for such endpoint for TT server is:

https://tt.api.sellercloud.com/api/Orders/ProfitAndLoss

For your server endpoint will be:

https://{your_server_id}.api.sellercloud.com/api/Orders/ProfitAndLoss

Request Payload

Response

FieldDescription
OrderIDID of the sales order.
OrderItemsArray of order items information related to fees, commissions, prices, costs for each item.
CurrencyCodeCurrency code of the order.
PaymentStatusAll available payment statuses can be found here:

https://sellercloud.com/developer/dev-article/payment-status/

ShippingStatusAll available shipping statuses can be found here:

https://sellercloud.com/developer/dev-article/order-shipping-status/

ShipDateWhen order has been shipped.
ChannelCodes for all channels can be found here:

https://sellercloud.com/developer/dev-article/channels/

CustomerIDID of the customer. That information can be used for doing other calls for retrieving additional information for that customer> More info here:

https://sellercloud.com/developer/dev-article/get-single-customer/

DropshipFeeDropshipping fee.

If orders is not using USD, then dropshipping fee will be calculated in the correct order’s currency according to the currency rates.
DropshipFeeUsdDropshipping fee in USD.
CommissionCommission fee. If order is from Amazon or FBA order, than commissions is “N/A”

If orders is not using USD, then commission will be calculated in the correct order’s currency according to the currency rates.

Response Status Codes

200

OK

401

Unauthorized

500

Internal Server Error

Demo in c#

Authentication

public DateTime? validFrom { get; set; }
public DateTime? validTo { get; set; }
}

public interface IAuthenticationClient
{
string Login(string baseUri, LoginRequest request);
}

public class LoginRequest
{

public LoginRequest(string username, string password)
{
this.Username = username;
this.Password = password;
}

public string Username { get; }

public string Password { get; }
}

var responseMessage = client.SendAsync(request).Result;

var content = responseMessage.Content
.ReadAsStringAsync()
.Result;

var response = JsonConvert.DeserializeObject(content);

return response.access_token;
}
}
}
}

Getting Profit And Loss

string username = “{your_username}”;
string password = “{your_password}”;

IAuthenticationClient authenticationClient = new AuthenticationClient();
string token = authenticationClient.Login(baseUri, new LoginRequest(username, password));

var content = new GetProfitAndLossRequest()
{
Orders = realOrders
};

using (var client = new HttpClient())
using (var request = new HttpRequestMessage(HttpMethod.Post, url))
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(“Bearer”, token);

var json = JsonConvert.SerializeObject(content);
using (var stringContent = new StringContent(json, Encoding.UTF8, “application/json”))
{
request.Content = stringContent;

var responseMessage = await client.SendAsync(request);

var jsonContent = await responseMessage.Content.ReadAsStringAsync();
}
}

Was this article helpful?

Next
REST Api Changes (2021)