Problem when creating client

Asked

Viewed 94 times

1

I can’t raise a client in Asmin. I can create an invoice, and access the data, but I’m not getting a customer.

This is the request I’m making on js:

function createClient(token) {
  var firstPartyClient = {
    "customerGroup": "01",
    "paymentMethod": "CC_DINHEIRO",
    "paymentTerm": "00",
    "partyTaxSchema": "IVA-RN-MN",
    "locked": false,
    "accountingSchema": 1,
    "oneTimeCustomer": false,
    "endCustomer": true,
    "partyKey": "NewCustomer",
    "searchTerm": "NewCustomer",
    "name": "NewCustomer",
    "isExternallyManaged": false,
    "currency": "EUR",
    "country": "PT",
    "isPerson": true
  };

  request({
      uri: customerParties,
      headers: {
        'Authorization': 'Bearer ' + token,
        'Content-Type': 'application/json',
        'Accept': 'application/json'
      },
      data: firstPartyClient,
      method: 'POST'
    }, function (err, res, body) {
      console.log(res);

      console.log("status: "+res.statusCode);
      console.log("status: "+err);
    });
}

The mistake I get is:

"{
  "validations": [
    {
      "propertyName": "customerPartyResource",
      "errorMessage": "Ambiguous match found."
    }
  ]
}"

I don’t know if it’s the wish that’s wrong.

  • You can put the Uri you’re wearing here?

  • Yes, uri:'https://my.jasminsoftware.com/api/<tenant>/<organization>/salescore/customerParties'

2 answers

0

I made exactly this call by POSTMAN and occurred without problems, either creating the Party or creating a customerParty. Validate if you are calling the correct endpoint and if it works using Postman.

inserir a descrição da imagem aqui

  • I hadn’t tested, but I did. I changed the way I was ordering to: request.post({`and already gave! Thank you. Does partyKey always have to be generated by me? There is no way to get from the system the next partyKey?

  • I suggest you put this question as answered and put a new one so that more users can see it and help.

0


I managed to solve. I switched to the way I ordered:

request.post({
      url: customerParties,
      headers: header,
      body: partyClient,
      json: true
  }, function (error, response, body) {
      console.log(body)
      if (!error && response.statusCode == 200) {
          console.log(body)
      } else {
        console.log(error);
      }
  });

Thanks for the help

Browser other questions tagged

You are not signed in. Login or sign up in order to post.