Create Vendor's Administrator Account Through Api

Hi community!
I run CS-Cart in the "Multivendor Plus" variant.
I can successfully create a vendor via the API. So far so good.
How can I create a vendor's administrator account for this vendor via API? In the GUI (Vendor > New Vendor) this option is called ("Create administrator account") - what is the name of the field in the API?
Best regards
hummer
[attachment=14512:api.PNG]

api.PNG

Hello,

You have to create vendor with status "N" (New), then use method PUT to change this vendor status to "A" (Active). This way, vendor will be active and vendor administrator will be auto-created.

If you will add vendor instantly with status "A", vendor administrator is not created.

Best regards,

Robert

Works, thank you!

Update the vendor to status A did the trick.

PUT /api/vendors/42 HTTP/1.1
Host: xxx.xxx.com:443
Content-Type: application/json
authorization: Basic bWFys2V0cGxhY3VAbG9naXN1aMNzLmNsb3VkOklJMjhaMFVHOUJxSGoya0oxenoyUTczckZUMG9zMHQz
content-length: 43

{
“status”: “A”
}

As expected I receive HTTP status 200. What irritates me is the PHP Notice with various error messages that are also displayed:
[attachment=14520:tempsnip.png]

Here is the complete output of this PHP notice:

PHP Notice

Message

Undefined index: email

Error at

app/functions/fn.companies.php, line: 829

Backtrace

File: app/functions/fn.companies.php
Line: 829
Function: {closure}
File: app/Tygh/Api/Entities/Stores.php
Line: 186
Function: fn_update_company
File: app/Tygh/Api.php
Line: 408
Function: update
File: app/Tygh/Api.php
Line: 332
Function: exec
File: app/Tygh/Api.php
Line: 281
Function: getResponseFromEntity
File: app/Tygh/Api.php
Line: 155
Function: getResponse
File: api.php
Line: 29
Function: handleRequest

PHP Notice

Message

Undefined index: language_code

Error at

app/Tygh/NotificationsCenter/NotificationsCenter.php, line: 129

Backtrace

File: app/Tygh/NotificationsCenter/NotificationsCenter.php
Line: 129
Function: {closure}
File: app/Tygh/Notifications/Transports/Internal/InternalTransport.php
Line: 93
Function: add
File: app/Tygh/Notifications/EventDispatcher.php
Line: 108
Function: process
File: app/functions/fn.companies.php
Line: 1386
Function: dispatch
File: app/functions/fn.companies.php
Line: 915
Function: fn_change_company_status
File: app/Tygh/Api/Entities/Stores.php
Line: 186
Function: fn_update_company
File: app/Tygh/Api.php
Line: 408
Function: update
File: app/Tygh/Api.php
Line: 332
Function: exec
File: app/Tygh/Api.php
Line: 281
Function: getResponseFromEntity
File: app/Tygh/Api.php
Line: 155
Function: getResponse
File: api.php
Line: 29
Function: handleRequest

PHP Warning

Message

Cannot modify header information - headers already sent by (output started at /var/www/cscart/app/Tygh/Tools/ErrorHandler.php:59)

Error at

app/Tygh/Api/Response.php, line: 248

Backtrace

File: app/Tygh/Api/Response.php
Line: 248
Function: {closure}
File: app/Tygh/Api.php
Line: 167
Function: send
File: api.php
Line: 29
Function: handleRequest
{"store_id":"42"}

Does anyone know what this is all about?

Best regards

hummer

tempsnip.png

Hello,

Have you passed the lang_code variable when creating vendor? This is what may be causing the notice "Undefined index: language_code".

You should also pass vendor e-mail address when making PUT request - this should remove the warning "Undefined index: email".

You can also fix it on code level: in file app/functions/fn.companies.php, on line 829, you can add condition to execute SQL query only if $_data['email'] is set.

Best regards,

Robert