+(923) 111 88 4444
TecniForge, 79/5-L, Sahiwal 57000

Contacts – Create Contact

Contacts – Create Contact

Create Contact. Requires “create_contact” API permission.POST https://androidapi.net/api/create/contact

Parameter #

FieldTypeDescription
secretStringThe API secret you copied from (Tools -> API Keys) page
phoneStringphone Recipient mobile number, it will accept E.164 formatted number or locally formatted numbers using the country code from your profile settings.
Example for Philippines
E.164: +639184661533
Local: 09184661533
nameStringName of contact
groupsStringList of contact group ID’s separated by commas. You can get group ID’s from /get/groups (Your contact groups).

Success Response Format #

FieldTypeDescription
statusNumberList of Codes
200 = Success
messageStringResponse message
dataArrayArray of data

Error Response Format #

NameTypeDescription
statusNumberList of Codes
400 = Invalid parameters
401 = Invalid API secret
403 = Access denied
500 = Something went wrong
messageStringResponse message
dataArrayArray of data

PHP Sample Code #

<?php

  $contact = [
      "secret" => "API_SECRET", // your API secret from (Tools -> API Keys) page
      "groups" => "1,2,3,4",
      "phone" => "+923012345678",
      "name" => "Martin Crater"
  ];

  $cURL = curl_init("https://androidapi.net/api/create/contact");
  curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($cURL, CURLOPT_POSTFIELDS, $contact);
  $response = curl_exec($cURL);
  curl_close($cURL);

  $result = json_decode($response, true);

  // do something with response

Python Sample #

import requests

# your API secret from (Tools -> API Keys) page
apiSecret = "API_SECRET"

contact = {
    "secret": apiSecret,
    "groups": "1,2,3,4",
    "phone": "+923012345678",
    "name": "Martin Crater"
}

r = requests.post(url = "https://androidapi.net/api/create/contact", params = contact)
  
# do something with response object
result = r.json()

Successful Response #

{
  "status": 200,
  "message": "Contact has been created!",
  "data": false
}

Error Response #

{
  "status": 400,
  "message": "Invalid Parameters!",
  "data": false
}

Leave A Comment