Skip to content

Samco Publisher

Easily copy and paste trade buttons to embed them on your website.

What is its purpose?

Integrating buttons into websites and apps to enable users to execute trades. The Samco Publisher buttons can seamlessly become part of your website by copying and pasting a few lines of HTML and JavaScript code.

Why?

Enhance the user experience for your audience, whether they're readers of your financial blog or consumers of your market analysis. Offer them a unique trading experience while also presenting the opportunity for additional revenue for you.

Is there any fees?

No, Samco Publisher is available free of charge.

How do I get my trade buttons?

First create a Publisher app and obtain API keys via /publihser/createApp API. Use these keys along with the necessary HTML/Javascript lines to embed buttons on your website as documented here.

Create App

This Publisher create API is to create a Publisher app and obtain API keys. POST /publisher/createApp

Code Sample

bash
curl -X POST 'https://tradeapi.samco.in/publisher/createApp' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"appName":"My App","redirectURL":"https://www.example.com/","description":"Description about the App"}'
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Sample {
  public static void main(String[] args) throws Exception {
    String requestBody = """
        {
          "appName": "My App",
          "redirectURL": "https://www.example.com/",
          "description": "Description about the App"
        }
        """;

    HttpClient client = HttpClient.newHttpClient();

    HttpRequest request = HttpRequest.newBuilder()
        .uri(URI.create("https://tradeapi.samco.in/publisher/createApp"))
        .header("Content-Type", "application/json")
        .header("Accept", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString(requestBody))
        .build();

    HttpResponse<String> response =
        client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(response.body());
  }
}
js
(async () => {
  const headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
  };

  const requestBody = {
    appName: "My App",
    redirectURL: "https://www.example.com/",
    description: "Description about the App"
  };

  const response = await fetch('https://tradeapi.samco.in/publisher/createApp', {
    method: 'POST',
    headers,
    body: JSON.stringify(requestBody),
  });

  const data = await response.json();
  console.log(data);
})();
py
import requests
import json

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
}

requestBody = {
  "appName": "My App",
  "redirectURL": "https://www.example.com/",
  "description": "Description about the App"
}

r = requests.post('https://tradeapi.samco.in/publisher/createApp',
  data=json.dumps(requestBody),
  headers=headers)

print(r.json())

Sample Request Body

json
requestBody={
  "appName": "My App",
  "redirectURL": "https://www.example.com/",
  "description": "Description about the App"
}

Parameters

NameTypeRequiredDescription
bodyobjectfalseContains the details for creating the app.
appNamestringtrueThe name of the app you want to create.
redirectURLstringtrueURL to which the user will be redirected after the order execution.
descriptionstringtrueA description of the app, providing details or information about its purpose or functionality.

Sample Response

json
{
    "serverTime": "06/02/24 14:02:03",
    "msgId": "d3001338-4312-45ca-8195-9edc6873577a",
    "status": "Success",
    "apiKey": "5TmpmCtzBnxq2MbDb",
    "statusMessage": "Publisher App created & api key generated"
}

Response Schema

Status Code 200

NameTypeDescription
serverTimestringThe current time at the server when the response was generated.
msgIdstringA unique identifier for the request. Use this ID when contacting support about any issues.
statusstringIndicates whether the login attempt was successful or failed.
statusMessagestringProvides additional information about the status of the login attempt.
apiKeystringThe API key required for creating HTML/JSON trade buttons.