Skip to main content

Partner operations

Listing

cURL
curl -X POST http://localhost:4000/NextUpServices/Services/POST/ \
-H "Content-Type: text/plain" \
-d "{\"AuthenticationToken\":\"$NX_TOKEN\",\"Method\":\"GetAllPartners\",\"Params\":{}}"

Adding a client

Node.js
const partner = await client._call('AddPartner', {
Code: 'CLI0099',
Name: 'Mihai Popescu SRL',
TaxCode: '12345678',
TaxAttribute: 'RO',
IsCompany: true,
IsClient: true
});
console.log(partner); // -> { Id: 28001, Code: 'CLI0099' }
Python
def add_partner(token, payload):
r = requests.post(
'http://localhost:4000/NextUpServices/Services/POST/',
data=json.dumps({
'AuthenticationToken': token,
'Method': 'AddPartner',
'Params': payload
}),
headers={'Content-Type': 'text/plain'}
)
body = r.json()
if body.get('Error'):
raise RuntimeError(body['Error'])
return body['Result']

p = add_partner(token, {
'Code': 'CLI0099', 'Name': 'Mihai Popescu SRL',
'TaxCode': '12345678', 'TaxAttribute': 'RO',
'IsCompany': True, 'IsClient': True
})

Updating the fiscal code

PHP
$resp = nx_call($token, 'UpdateCIF', ['Code' => 'CLI0099', 'CIF' => 'RO87654321']);
// $resp === true

Idempotent: AddOrUpdatePartner

For integrations that receive data from another system and do not know whether the partner already exists:

cURL
curl -X POST http://localhost:4000/NextUpServices/Services/POST/ \
-H "Content-Type: text/plain" \
-d "{
\"AuthenticationToken\":\"$NX_TOKEN\",
\"Method\":\"AddOrUpdatePartner\",
\"Params\":{\"Code\":\"CLI0099\",\"Name\":\"Mihai Popescu SRL\"}
}"

Partner balance

Python
balance = nx_call(token, 'GetSold', {})
# [{'PartnerId': 27501, 'Code': 'CLI0001', 'Name': 'ACME SRL', 'Sold': -1240.55}, ...]