Getting Started

Introduction

Welcome to the Pasifik API V2 document! You can use our API to access Pasifik API endpoints, which can get information on various of services.

This document will provide instructions on how to quickly integrate Pasifik Telekom services into various solutions by using Pasifik HTTP application programming interface (HTTP API). The HTTP API can be used for sending SMS, and watching telephones or your PBX activities, send and receive Fax, collecting delivery reports, check your balance. Pasifik’s API is based on REST standards, enabling you to use your browser for accessing URLs. In order to interact with our API, any HTTP client in any programming language can be used.

We have language bindings in Shell, PHP, and Python! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Base URL

Submit all requests to the base URL. All the requests are submitted thorough HTTP POST, PUT or GET method. Although you can use HTTP protocol, we strongly recommend you to submit all requests to Pasifik SMS API over HTTPS so the traffic is encrypted and the privacy is ensured.

Http Headers

Pasifik SMS API supports JSON and XML Content-Types and Accept criteria that should be specified in the header. If the Content-Type is not specified you will receive a General error. Depending which Accept type is chosen in the deader for the request, the same one will be applied in the response.

Content-Type: application/json
Accept: application/json

Content-Type: application/xml
Accept: application/xml

Authentication

We support basic authorization using a username and password with Base64 encoding variation RFC2045-MIME.

The authorization header is constructed as follows:

Username and password are combined into a string username:password.

The resulting string is encoded using the RFC2045-MIME variant of Base64.

Example:

Username: Aladdin

Password: open sesame

Authorization: QWxhZGRpbjpvcGVuIHNlc2FtZQ==

You must replace `QWxhZGRpbjpvcGVuIHNlc2FtZQ==` with your personal API authentication.

SMS

In a few simple steps, we will explain how to send an SMS using Pasifik HTTP API. The message will be sent only to a valid phone number (numbers), written in
international format e.g. 41793026727.

Phone numbers format We strongly recommend using the E.164 number formatting. E.164 numbers are internationally standardized to a fifteen digit maximum length. Phone numbers are usually prefixed with + (plus sign), followed by a country code, network code and the subscriber number. Phone numbers that are not E.164 formatted may work, depending on the handset or network.

Submit SMS

Submit: send one SMS to many numbers.

Submit Multi: send many SMS to many numbers.

Query SMS

Query Multi: get General Report by Date Time range (start_date, end_date).

International SMS

Universal SMS now you can send sms outside of country, and that is useful for Travel Agency, or Hotel Reservation. we made it simple "universal" boolean field. just set it as true.
and make sure you should prefix it with + e.g. "+19999999999".

"universal": true

Alphabet

Turkish SMS In your SMS business usage, you might have noticed that if your text contains characters specific to your country’s alphabet, the number of remaining SMS characters drops to just 70. Your business has the option of creating & sending long messages but you don’t really like the cost of doing so, do you? National Language Identifier is an encoding technology which allows an SMS containing language specific characters usually treated as 16bit Unicode to be delivered as original text, while only deducting 5 characters from the maximum SMS length – 155 characters allowed. Stay true to your language by sending Fully featured textual message and setting "alphabet":"TurkishSingleShift".

Flash SMS Besides standard SMS message, you are able to send flash messages over Fully featured textual message API method. Flash SMS will pop-up on the user’s phone when it’s received. Message can be stored on the mobile phone and has a sender ID. In order to send flash message, set "alphabet":"DefaultMclass0".

Unicode SMS Unicode (UTF-8) messages can be sent by textual Send SMS method, This method support all universal language Chinese, Japanese, Arabic, Greek and all non-GSM characters under Unicode, the text of the message is limited to 70 characters. Here you can find what characters are included in GSM set, set "alphabet":"UCS2".

Schedule SMS and Validity period

POST/en/api/sms/submit/HTTP/1.1Host:oim.pasifiktelekom.com.trAuthorization:QWxhZGRpbjpvcGVuIHNlc2FtZQ==Content-Type:application/jsonAccept:application/json{"from":"YOURCOMPANY","to":"905999999999","text":"The time-traveling is just too dangerous.
Better that I devote myself to study the other great mystery of the universe: women!","scheduled_delivery_time":"2016-07-23T21:54:02Z","period":1440}

{"from":"YOURCOMPANY","to":"905999999999","text":"The time-traveling is just too dangerous.
Better that I devote myself to study the other great mystery of the universe: women!","scheduled_delivery_time":"2016-07-23T21:54:02Z","period":1440}

<?php$request=newHttpRequest();$request->setUrl('https://oim.pasifiktelekom.com.tr/en/api/sms/submit/');$request->setMethod(HTTP_METH_POST);$request->setHeaders(array('accept'=>'application/json','content-type'=>'application/json','authorization'=>'QWxhZGRpbjpvcGVuIHNlc2FtZQ=='));$request->setBody('{
"from":"YOURCOMPANY",
"to":"905999999999",
"text": "The time-traveling is just too dangerous.
Better that I devote myself to study the other great mystery of the universe: women!",
"scheduled_delivery_time": "2016-07-23T21:54:02Z",
"period": 1440
}');try{$response=$request->send();echo$response->getBody();}catch(HttpException$ex){echo$ex;}

require'uri'require'net/http'url=URI("https://oim.pasifiktelekom.com.tr/en/api/sms/submit/")http=Net::HTTP.new(url.host,url.port)http.use_ssl=truehttp.verify_mode=OpenSSL::SSL::VERIFY_NONErequest=Net::HTTP::Post.new(url)request["authorization"]='QWxhZGRpbjpvcGVuIHNlc2FtZQ=='request["content-type"]='application/json'request["accept"]='application/json'request.body="{\"from\":\"YOURCOMPANY\",\"to\":\"905999999999\", \"text\": \"The time-traveling is just too dangerous. Better that I devote myself to study the other great mystery of the universe: women!\", \"scheduled_delivery_time\": \"2016-07-23T21:54:02Z\", \"period\": 1440}"response=http.request(request)putsresponse.read_body

importhttp.clientconn=http.client.HTTPSConnection("oim.pasifiktelekom.com.tr")payload="{\"from\":\"YOURCOMPANY\",\"to\":\"905999999999\", \"text\": \"The time-traveling is just too dangerous. Better that I devote myself to study the other great mystery of the universe: women!\", \"scheduled_delivery_time\": \"2016-07-23T21:54:02Z\", \"period\": 1440}"headers={'authorization':"QWxhZGRpbjpvcGVuIHNlc2FtZQ==",'content-type':"application/json",'accept':"application/json"}conn.request("POST","/en/api/sms/submit/",payload,headers)res=conn.getresponse()data=res.read()print(data.decode("utf-8"))

HttpResponse<String>response=Unirest.post("https://oim.pasifiktelekom.com.tr/en/api/sms/submit/").header("authorization","QWxhZGRpbjpvcGVuIHNlc2FtZQ==").header("content-type","application/json").header("accept","application/json").body("{\"from\":\"YOURCOMPANY\",\"to\":\"905999999999\", \"text\": \"The time-traveling is just too dangerous. Better that I devote myself to study the other great mystery of the universe: women!\", \"scheduled_delivery_time\": \"2016-07-23T21:54:02Z\", \"period\": 1440}").asString();

varclient=newRestClient("https://oim.pasifiktelekom.com.tr/en/api/sms/submit/");varrequest=newRestRequest(Method.POST);request.AddHeader("accept","application/json");request.AddHeader("content-type","application/json");request.AddHeader("authorization","QWxhZGRpbjpvcGVuIHNlc2FtZQ==");request.AddParameter("application/json","{\"from\":\"YOURCOMPANY\", \"to\":\"905999999999\", \"text\": \"The time-traveling is just too dangerous. Better that I devote myself to study the other great mystery of the universe: women!\", \"scheduled_delivery_time\": \"2016-07-23T21:54:02Z\", \"period\": 1440}",ParameterType.RequestBody);IRestResponseresponse=client.Execute(request);

vardata=JSON.stringify({"from":"YOURCOMPANY","to":"905999999999","text":"The time-traveling is just too dangerous. Better that I devote myself to study the other great mystery of the universe: women!","scheduled_delivery_time":"2016-07-23T21:54:02Z","period":1440});varxhr=newXMLHttpRequest();xhr.withCredentials=false;xhr.addEventListener("readystatechange",function(){if(this.readyState===this.DONE){console.log(this.responseText);}});xhr.open("POST","https://oim.pasifiktelekom.com.tr/en/api/sms/submit/");xhr.setRequestHeader("authorization","QWxhZGRpbjpvcGVuIHNlc2FtZQ==");xhr.setRequestHeader("content-type","application/json");xhr.setRequestHeader("accept","application/json");xhr.send(data);

Schedule SMS sending and set a validity period for your messages. If you want to schedule your SMS to be sent later you can use "scheduled_delivery_time" parameter in the Fully featured textual message API method. This will set a specific date and time when the message will be sent.

Besides scheduling messages, you can also set validity period for every SMS sent over Fully featured textual message API method. The message "period" parameter should be set in minutes as integer. The message sending will not be allowed after the set period expires. The maximum validity period is 24 hours and if you put a longer period, we will automatically set it to 24h.

If the request is syntactically correct, response header HTTP status code will be 200 OK and the response will contain array with logs matching given filter. If you try to get logs without authorization, you will receive an error 401 Unauthorized. If your request is syntactically incorrect, you will receive an error 400 Bad Request.

HTTP Request

Request Body

Response Body

The explanations for these extension settings are as follows:

disallow=all − Disables the use of all codecs. Used before specific codecs are enabled in order of preference.

allow=ulaw − Enables a codec based on the μ-law algorithm that is used primarily in North America and Japan. Provides slightly more dynamic range than A-law. This is a 64 kbps PCM (Pulse Code Modulation) codec and a companding variant of the ITU-T G.711 standard. All such codecs impose a minimal load on the CPU.

allow=alaw − Enables a codec based on the A-law algorithm that is used in Europe and the rest of the world. Requires even less CPU processing power than μ-law. In the USA, it is used by convention for international connections if at least one party uses it. Another ITU-T G.711 variant.

allow=gsm − Enables the GSM 06.10 codec, which is the preferred codec for Asterisk. It operates at 13 kbps, employs lossy speech compression, has no licensing requirements and offers excellent CPU-related performance.

qualify=yes − When enabled, SIP NOTIFY messages will periodically be sent to the remote peer to determine both its availability and the latency of its replies.

canreinvite=no − Prevents the two end points from connecting to each other directly, which is normal behavior when using SIP. This forces Asterisk to remain in the transmission path, which is necessary to detect DTMF signals. Some commercial SIP providers also do this.

Provider

Section title. All lines between this section title and the next apply to this section only. This name will be referred to in the dial plan to establish outgoing calls.

type=peer − Definition of the connection type. Type peer is for outgoing connections. Used in cases when the remote host is not expected to place calls (for routing) to this host − only vice versa.

context=incoming − The name specified here, which is arbitrary, will determine where incoming calls will enter the dial plan when they arrive on the channel associated with this section.

host=provider.example.com − Sets the name of the remote host to which this host must connect. In this case the value must be a fully qualified domain name.

username=jsmith − Sets the username with which Asterisk authenticates to a peer, as well as the username for the peer to use when authenticating to Asterisk. This overrides the name in the section title (between the square brackets) that is normally used for this purpose. Also allows registration with a peer before that peer has registered with Asterisk. This option may also be required by other features, such as dialout from voicemail.

fromuser=jsmith − Another method of specifying the username for authentication with a peer to override the name in the section title. With some SIP providers, this option may be required for the channel definition to work.

secret=yourverysecretpassword − Sets the password. Used for authentication together with the name (title) of this section, which in this case is overridden by fromuser=jsmith.

SIP-Phone

Section title. All lines between this section title and the next apply to this section only. This name will be referred to in the dial plan to establish outgoing calls.

type=friend − Definition of the connection type. Type friend is a combination of both user and peer types, since the remote host can connect to this host, as well as vice versa.

context=outgoing − The name specified here, which is arbitrary, will determine where outgoing calls will enter the dial plan when they are made with the phone associated with this section.

host=dynamic − Configures the host to which this host is to connect, although dynamic is used to indicate that the connecting host uses a dynamic IP address.

secret=yourverysecretpassword − Sets the password. Used for authentication together with the name (title) of this section.

true means “resize to 1728x2255, set density to 204x196 TIFF” that is compatible with modern fax machines, false means “resize to 1728x1078, set density 204x98 TIFF” that is compatible with modern and old fax machines.

it is based on file converted format [“tiff”, “pdf”], sometimes the *.doc or other format you send does not available or was deleted permanently.

is_enhanced

boolean

false

No

true means “resize to 1728x2255, set density to 204x196 TIFF” that is compatible with modern fax machines, false means “resize to 1728x1078, set density 204x98 TIFF” that is compatible with modern and old fax machines.

Request Body

Response Body

the response will be contain application/json data type contains:

Name

Type

filename

string

code

integer

message

string

Errors

This error section is stored in a separate file in `includes/_errors.md`. Slate allows you to optionally separate out your docs into many files…just save them to the `includes` folder and add them to the top of your `index.md`’s frontmatter. Files are included in the order listed.

The Pasifik API uses the following error codes:

Error Code

Meaning

400

Bad Request – Your request sucks

401

Unauthorized – Your API key is wrong

403

Forbidden – The kitten requested is hidden for administrators only

404

Not Found – The specified kitten could not be found

405

Method Not Allowed – You tried to access a kitten with an invalid method

406

Not Acceptable – You requested a format that isn’t json

410

Gone – The kitten requested has been removed from our servers

418

I’m a teapot

429

Too Many Requests – You’re requesting too many kittens! Slow down!

500

Internal Server Error – We had a problem with our server. Try again later.