1

I have been trying about a week but I couldn't make a post request to get a result. I tried a bunch of middlewares (exp: 'request', 'axios', 'reqclient','superagent etc..) but I couldn't make it.

Please provide me a simple post request with sending API key and body.

I also read all the documentation.

Please check below to see what I want :

*Authentication API key required.

*O-Auth Scopes trades

*Input One of: user_id + token or user_url is required.


here is my one of try :

const request = require('request-promise')

    const options = {
        method: 'POST',
        uri: 'api-site.com/Offer/v1/',
        headers: {
          'User-Agent': 'Request-Promise',
          'Authorization': 'Basic 123123asdasd123123'
        },
        body: {
            user_url: "site.com/user/user1234123",
            otherparams: "parameter"
          },
          json: true 
      };

      request(options)
      .then(function (response) {
        Console.log(response);
      })
      .catch(function (err) {
        console.log('Error ', err.message);
      });

I am getting this output :

Error  : 401 - {"status":401,"time":1540458426,"message":"API Key Required"}

I tried some other request post middle-wares and played with content-type (application/json. dataForm, x-www-form-urlencoded) or

changed the location of my API key from header to body or

tried my API key inside of auth{authorization: "API Key"}

tried much more.

the result didn't change. I got the same output or errors.

EDIT :

this is the link that I am trying to do but got stack : check here

Enis Gur
  • 89
  • 1
  • 9
  • 1
    Your requirement did not state how should the `Authentication API key` be sent, which is usually either in `Authorization` header as `Bearer xxx`. You need to provide more documentation on the API you are trying to call. – William Chong Oct 25 '18 at 10:12
  • https://docs.opskins.com/public/en.html I did all these. I have Api key, client_id, secret bearer token. now I want to do this: https://github.com/OPSkins/trade-opskins-api/blob/master/ITrade/SendOffer.md – Enis Gur Oct 25 '18 at 10:34
  • as seen in https://docs.opskins.com/public/en.html#calling-the-api , you call the API with a bearer token in `Authorization: Bearer AQAAAAQAAAAAAAVd4P////`, section https://docs.opskins.com/public/en.html#getting-a-bearer-token describe how can you get such token – William Chong Oct 25 '18 at 10:38
  • There is no any option to call sendOffer function at opskinapi. or I can't find. Opskin api only be able to sale items or check, edit profile. deposit withdraw staff. But I want to use trade api. Which I can send offers between users to send each other items. – Enis Gur Oct 25 '18 at 10:49
  • I opened 3 accounts from there and I have some items also. I just want to send from one of my user to other my user id and user_url offer. – Enis Gur Oct 25 '18 at 10:52
  • thats very far from the the "API key" problem then, you might want to reformat your question – William Chong Oct 25 '18 at 10:53
  • I got confuse a little bit, and I wish I could explain better. – Enis Gur Oct 25 '18 at 10:57
  • I asked help from their issues page also. I hope I will get it done soon. https://github.com/OPSkins/trade-opskins-api/issues/102 – Enis Gur Oct 25 '18 at 11:00

1 Answers1

0

Solved ! Everything works great. Problem was I needed to send my API Key base64 string.

Buffer.from("your_api_key_value" + ":", "ascii").toString("base64")
Enis Gur
  • 89
  • 1
  • 9