Description |
Posts an user to nativy and returns the created user with public and private api_key for further usage. |
URL |
/connect/user |
Parameters |
nativy_partner_api_key (required) |
string |
The public API key of the nativy partner account.
Only nativy partners are allowed to create or update users, please contact us if you need to create users from your application. (Details:
Authentication) |
nativy_partner_timestamp (required) |
string |
The current UTC timestamp (seconds from 1/1/1970 until UTC now). (Details:
Authentication) |
nativy_partner_api_sign (required) |
string |
The timestamp encoded with HMAC SHA1 in use of the private key. (Details:
Authentication) |
gender (required) |
string |
The gender of the user (use "F" for female and "M" for male). |
firstname (required) |
string |
The first name of the user. |
lastname (required) |
string |
The last name of the user. |
email (required) |
string |
The email address of the user. |
company |
string |
The company name of the user, in case the user orders translations for his company. |
street (required) |
string |
The street of the user. This will be used as the default street for invoices, you may post a different address when posting an order to nativy. |
zip (required) |
string |
The zip (postal code) of the user. This will be used as the default zip for invoices, you may post a different address when posting an order to nativy. |
city (required) |
string |
The city of the user. This will be used as the default city for invoices, you may post a different address when posting an order to nativy. |
country_code (required) |
string |
The 2 letter long country code of the user's country in ISO 3166-1-alpha-2 format. This will be used as the default country for invoices, you may post a different address when posting an order to nativy. |
password (required) |
string |
The password for the user's nativy account. Minimum length must be 6 characters. |
vatnumber |
string |
The vat number of the user's company. (Details: http://en.wikipedia.org/wiki/VAT_identification_number) |
phone |
string |
The phone number of the user. |
degree |
string |
The degree of the user (e.g. Dr.). |
Example call
$url = 'https://webapp.nativy.com/connect/user';
$partner_api_key = 'iQU5lBuEjYFax2EU3o>bp*u02K^Bmie3d}pg-pU^MZ&%mobYM&x7SHY+41u7PHEh';
$partner_private_key = '4i2j_F|=lUqNRxPMxtxsX-veXJ)i+w(hq[_J&(r{Pn[jyT&)xt*Usp3K%B_jv{tP';
$partner_timestamp = gmdate('U');
$hmac = hash_hmac('sha1', $partner_timestamp, $partner_private_key);
$user = array(
'nativy_partner_api_key' => $partner_api_key,
'nativy_partner_api_sign' => $hmac,
'nativy_partner_timestamp' => $partner_timestamp,
'gender' => 'M',
'firstname' => 'Anton',
'lastname' => 'Kerschbaummayr',
'email' => 'testuser_ak@nativy.com',
'company' => 'nativy GmbH',
'street' => 'Novaragasse 38A/9',
'zip' => '1020',
'city' => 'Wien',
'country_code' => 'AT',
'password' => 'testpassword123-#(0',
'vatnumber' => 'ATU66603856',
'phone' => '+43 699 11220883',
'degree' => 'Ing.'
);
$user = json_encode($user);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $user);
$response = curl_exec($ch);
curl_close($ch);
echo ($response);
Return values
The same as post parameters including:
api_public_key |
string |
The public "api_key" key of the user. Use this key as "api_key" for creating orders etc. for this user. |
api_private_key |
string |
The private key of the user. Use this key to sign requests for this user. Store this key secure in your application. |
user_picture_link |
string |
The account image the user uses on nativy.com. |
payment_modes |
array |
The payment options the user has as a string array. Can be one or more of the following payment modes:
-
credit_card
If the user chooses to pay by credit card, you must redirect your user to the payment_link (in an iframe or a popup window) after the user has chosen a translator offer. You get the payment_link for each offer after calling /order POST.
-
bank_transfer
The user is allowed to pay via bank transfer. Call /order/{orderid}/{rank} PUT to choose an offer. The user gets the nativy bank account details on his invoice which can be downloaded with /order/{orderid}/invoice GET
|
Example return values
{
"api_key":null,
"api_private_key":"4i2j_F|=lUqNmxPMxtxsX-veXJ)i+w(hq[_J&(r{Pn[jyT&)xt*Usp3K%B_jv{tP",
"api_public_key":"iQU5lBuEjYFMx2EU2o>bp*u02K^Bmie3d}pg-pU^MZ&%mobYM&x7SHY+41u7PHEh",
"api_sign":null,
"city":"Wien",
"company":"nativy GmbH",
"country_code":"AT",
"degree":"Ing.",
"email":"testuser_ak@nativy.com",
"firstname":"Anton",
"gender":"M",
"lastname":"Kerschbaummayr",
"nativy_partner_api_key":null,
"nativy_partner_api_sign":null,
"nativy_partner_timestamp":null,
"payment_modes": ["credit_card", "bank_transfer"],
"phone":"+43 699 11220883",
"street":"Novaragasse 38A\/9",
"timestamp":null,
"user_picture_link":"http:\/\/test.nativy.com:55208\/ShowImage.ashx?PersonId=8e2158ad-98cf-4f50-b6d4-6ae85ee7c398&Size=PictureFileSmall",
"vatnumber":"ATU65800617",
"zip":"1020"
}