REST API‎ > ‎Registration‎ > ‎

Register

This method registers a network ID and phone number pair and relates them to an application.

Method: POST

URI: /api/rest/registrant/

Form parameters:
  • networkid The network ID to be registered.
  • phone The phone number to relate to the network ID.  Required only for networkids that are not already registered with an application.
  • appkey The application key of the application with which to associate the (phonenetworkid) pair.
  • greetingid  The media ID of the greeting to play to the potential registrant.
ALL NUMBERS 1 + 10 DIGITS U.S. WIRELESS ONLY
ie.14151239876
First -- this is for US Mobiles only.  We do realtime lookups on the phone number and verify that it's a US wireless number.  If you get a failure on registration, it's simply because your user entered a non-US or non-mobile phone number.  Really!  We reject land lines, VOIP, Skype numbers, Google Voice.  We support only US Mobile carriers.

If the networkid specified in the request is already registered with another application in the Telesocial system, then the phone number parameter may be omitted.  This is because after a successful registration of a networkid (with any application) the registrant's phone number has already been obtained and verified.  In such cases, the Register method creates a new association between the networkid and the application identified by the appkey, but does not perform an additional phone number verification.

Query parameters: None


Returns:
CREATED(201)The registration succeeded, pending phone authentication.
BAD_REQUEST(400)One or more parameters were invalid or this (phone, networkid) pair is already registered.
UNAUTHORIZED(401) The greetingid refers to media that is not associated with the application.
BAD_GATEWAY(502)Unable to start the phone authorization process.

Response format: JSON

Example:

curl -d "appkey=1f1bbca5-b71f-4138-97b6-59fed80623bc&networkid=1000022816599&phone=14054441212" https://api.telesocial.com/api/rest/registrant

Response body

{"RegistrationResponse":{"message":"","status":201,"uri":"\/api\/rest\/registrant\/1000022816599"}}


PHP Example

In the example below, a new user is authorized with a custom greeting.

    public function createNetworkID($networkID, $phone = false, $greetingID = '7c12312323234b199406085afccc4d7b')
    {
        $query = new telesocialQuery('registrant');
        $query->addApiKey()->add('networkid', $networkID);

        if ($phone)
        {
            if ($phone{0} != '1')
            {
                $phone = '1' . $phone;
            }

            $query->add('phone', $phone);
        }

        if ($greetingID)
        {
            $query->add('greetingid', $greetingID);
        }

        if ($query->make())
        {
            return $query->response['status'] == 201;
        }

        return false;
    }


Ruby Example 

 def get_registration_status(network_id, query = "exists")
      response = post("/api/rest/registrant/#{network_id}", :body => {:query => query, :appkey => @api_key})

      case response.status
      when 200
        response.registered = true
      when 401
        raise Telesocial::Unauthorized.new("The network ID exists but it is not associated with the specified application", response)
      when 404
        raise Telesocial::NotFound.new("The device is not registered.", response)
      else
        raise Telesocial::Error.new(response.message, response)
      end

      return response
    end