Baselinker API requests

How should I set up a Query param, and how should the cURL for baselinker API look like?

Here is a Baselinker API documentation
https://api.baselinker.com/index.php

Introduction

The API enables the information exchange between an external system and BaseLinker.
Communication uses data in JSON format. To make a request to the API, send the proper POST request to:
https://api.baselinker.com/connector.php

To send a request for each method, a token is required. The token is assigned directly to the BaseLinker user account. User can generate API token in BaseLinker panel in “Account & other → My account → API” section.
Authorization with http header (X-BLToken) is recommended.

3 values must be submitted to the connector.php file via POST:

  1. token - unique user API key - DEPRECATED, please use X-BLToken header
  2. method - the name of the requested API method
  3. parameters - arguments of the requested function in JSON format

Sample:curl 'https://api.baselinker.com/connector.php' -H 'X-BLToken: 1-23-ABC' --data-raw 'method=getOrders&parameters=%7B%22date_from%22%3A+1407341754%7D'

The cURL is not very clear for me:
what is “-H”?
What are ’ separators in the cURL?
Is --data-raw a part of the curl that will be created with request (or it is fine when I set it in Body section like I did)?

I’v set api key, so no longer “error_message”:“No user token provided.” appears.
As a body I selected raw/JSON

So how should I set params to make my getOrders request?
What should i put in Body section?

I tried a lot but nothing seems to be working - always the same message:
“error_message”:“An empty or unknown method has been used”

Please help - because i’m stuck :confused:

Hi @pablogemba

You can use the “Import” option in Postman and select the “Raw Text” option to import cURL straight in to Postman, like this;

image

This will automatically create the request in Postman like this;
image

image

Ok.

Just did what you told me and there are some problems:
1st. In API documentation, it’s stated - Communication uses data in JSON format.
And here it’s set for x-www-form-urlencoded.
2nd. X-BLToken is set as 1-23-ABC (I just went to Authorization tab and made it as API doc said


Hope that is correct…
But when I hit SEND, it’s the same outcome again.

{“status”:“ERROR”,“error_code”:“ERROR_UNKNOWN_METHOD”,“error_message”:“An empty or unknown method has been used”}

Any idea why ?
Is it because I should make parameters in JSON?

Can you provide screenshots of what you have tried?

I tried


Of course there is a X-BLToken on the 1st place
And I’m writing Parameters
image

@pablogemba

In the screenshot where you have the key\value that you want to add to the header.

You have the key as “X-BLToken” and the value as {{Token}} which is a variable that I don’t think you have set anywhere.

Therefore, the error “an empty or unknown method”.

Ideally, this should be set as an environment variable.

So - under the {{Token}} is a value of my real token which I got from my Baselinker.
It’s set like that, because I don’t want to share an API token in public.

@pablogemba

Ok, but where do you have this set?

Can you confirm that it is set in an environment variable?