### PHP Autoload Example Source: https://apidoc.fax.plus/get-started/quickstart Basic PHP setup using Composer's autoloader. This snippet is a starting point for integrating with the Fax.Plus API in PHP. ```php 'application/json', 'Authorization' => 'Bearer {access-token}', // The x-fax-clientid header is required only when using the OAuth2 token scheme 'x-fax-clientid' => '{client ID}', ); $client = new GuzzleHttp try { $response = $client->request('GET','https://restapi.fax.plus/v3/accounts/{user_id}', array( 'headers' => $headers, ) ); print_r($response->getBody()->getContents()); } catch (GuzzleHttp // ... ``` -------------------------------- ### Get Token Info with Java (Apache HTTP Client) Source: https://apidoc.fax.plus/api-reference/endpoints/authentication/get-token-info This Java example demonstrates how to get token information using Apache HTTP Client 4 with its Fluent API. It sends a GET request to the token endpoint with appropriate headers. ```java /** * Example below uses Apache HTTP Client 4 with Fluent API **/ String url = "https://restapi.fax.plus/v3/auth/token"; String result = Request .Get(url) .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer {access-token}") .execute() .returnContent().asString(); System.out.println(result.toString()); ``` -------------------------------- ### Get User Information (Java) Source: https://apidoc.fax.plus/api-reference/endpoints/accounts/get-account-information Example using Apache HTTP Client 4 with Fluent API to get user information. Remember to replace placeholders for `YOUR_CLIENT_ID`, `access-token`, and the `user_id`. ```java /** * Example below uses Apache HTTP Client 4 with Fluent API **/ Map pathParams = new HashMap<>(); pathParams.put("user_id", "'473e1eb6'"); StrSubstitutor sub = new StrSubstitutor(values, "{", "}"); String url = sub.replace("https://restapi.fax.plus/v3/accounts/{user_id}"); String result = Request .Get(url) // The x-fax-clientid header is required only when using the OAuth2 token scheme .addHeader("x-fax-clientid", "YOUR_CLIENT_ID") .addHeader("Accept", "'application/json'") .addHeader("Authorization", "'Bearer {access-token}'") .execute() .returnContent().asString(); System.out.println(result.toString()); ``` -------------------------------- ### List Contacts with Go Source: https://apidoc.fax.plus/api-reference/endpoints/contacts/list-contacts This Go example shows how to make an HTTP GET request to list contacts. Remember to include the 'x-fax-clientid' header if you are using OAuth2 token authentication. ```go package main import ( "bytes", "net/http" ) func main() { headers := map[string][]string{ // The x-fax-clientid header is required only when using the OAuth2 token scheme "Accept": []string{"application/json"}, "Authorization": []string{"Bearer {access-token}"}, "x-fax-clientid": []string{"YOUR_CLIENT_ID"} } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://restapi.fax.plus/v3/accounts/self/contacts?search=&offset=0&limit=50", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` -------------------------------- ### Install Javascript SDK Source: https://apidoc.fax.plus/backend-sdks/javascript Install the Fax.Plus Javascript SDK package using npm or yarn. ```bash // with npm npm install @alohi/faxplus-api // with yarn yarn add @alohi/faxplus-api ``` -------------------------------- ### Installation Source: https://apidoc.fax.plus/backend-sdks/javascript Install the Fax.Plus Javascript SDK package using npm or yarn. ```bash npm install @alohi/faxplus-api yarn add @alohi/faxplus-api ``` -------------------------------- ### Get Number Information with Go Source: https://apidoc.fax.plus/api-reference/endpoints/numbers/get-number-information A Go example for retrieving fax number details. Ensure the 'x-fax-clientid' header is present for OAuth2 authentication. ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ // The x-fax-clientid header is required only when using the OAuth2 token scheme "Accept": []string{"application/json"}, "Authorization": []string{"Bearer {access-token}"}, "x-fax-clientid": []string{"YOUR CLIENT_ID"} } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://restapi.fax.plus/v3/accounts/{user_id}/numbers/{number}", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` -------------------------------- ### Get Number Information with Java Source: https://apidoc.fax.plus/api-reference/endpoints/numbers/get-number-information This Java example demonstrates how to fetch number information using Apache HTTP Client. Remember to include the 'x-fax-clientid' header if using OAuth2. ```java /** * Example below uses Apache HTTP Client 4 with Fluent API **/ Map pathParams = new HashMap<>(); pathParams.put("user_id", "'23415ufasx8df7'"); pathParams.put("number", "'+123417543010'"); StrSubstitutor sub = new StrSubstitutor(values, "{", "}"); String url = sub.replace("https://restapi.fax.plus/v3/accounts/{user_id}/numbers/{number}"); String result = Request .Get(url) // The x-fax-clientid header is required only when using the OAuth2 token scheme .addHeader("x-fax-clientid", "YOUR CLIENT_ID") .addHeader("Accept", "'application/json'") .addHeader("Authorization", "'Bearer {access-token}'") .execute() .returnContent().asString(); System.out.println(result.toString()); ``` -------------------------------- ### Get Member Details using Java Source: https://apidoc.fax.plus/api-reference/endpoints/accounts/get-member-details This Java example demonstrates fetching member details using Apache HTTP Client. Remember to include the `x-fax-clientid` header if using OAuth2. ```java /** * Example below uses Apache HTTP Client 4 with Fluent API **/ Map pathParams = new HashMap<>(); pathParams.put("member_user_id", "'473e1eb612451s'"); StrSubstitutor sub = new StrSubstitutor(values, "{", "}"); String url = sub.replace("https://restapi.fax.plus/v3/accounts/self/member-details/{member_user_id}"); String result = Request .Get(url) // The x-fax-clientid header is required only when using the OAuth2 token scheme .addHeader("x-fax-clientid", "YOUR_CLIENT_ID") .addHeader("Accept", "'application/json'") .addHeader("Authorization", "'Bearer {access-token}'") .execute() .returnContent().asString(); System.out.println(result.toString()); ``` -------------------------------- ### Create Contact Request Example Source: https://apidoc.fax.plus/api-reference/endpoints/contacts/create-contact Example of a JSON request body to create a new contact. Ensure all required fields are populated. ```json { "firstName": "John", "lastName": "Doe", "email": "john.doe@example.com", "phone": "123-456-7890", "address": "123 Main St", "notes": "Important client" } ``` -------------------------------- ### Get Account Information Source: https://apidoc.fax.plus/get-started/quickstart This example demonstrates how to retrieve account information using the Fax.Plus API with Guzzle. ```APIDOC ## GET /v3/accounts ### Description Retrieves information about the authenticated account. ### Method GET ### Endpoint https://restapi.fax.plus/v3/accounts ### Parameters #### Headers - **Accept** (string) - Required - `application/json` - **Authorization** (string) - Required - `Bearer {access-token}` - **x-fax-clientid** (string) - Required - `{client-id}` ### Request Example ```php 'application/json', 'Authorization' => 'Bearer {access-token}', 'x-fax-clientid' => '{client-id}', ); $client = new GuzzleHttp\Client(); try { $response = $client->request('GET', 'https://restapi.fax.plus/v3/accounts', array( 'headers' => $headers, )); print_r($response->getBody()->getContents()); } catch (GuzzleHttp\Exception\BadResponseException $e) { print_r($e->getMessage()); } ?> ``` ### Response #### Success Response (200) - **body** (object) - Contains account details. ``` -------------------------------- ### Get User Information (Go) Source: https://apidoc.fax.plus/api-reference/endpoints/accounts/get-account-information This Go snippet shows how to make a GET request to retrieve user information. It includes setting up headers for authentication and content type. The `x-fax-clientid` header is needed for OAuth2. ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ // The x-fax-clientid header is required only when using the OAuth2 token scheme "Accept": []string{"application/json"}, "Authorization": []string{"Bearer {access-token}"}, "x-fax-clientid": []string{"YOUR_CLIENT_ID"} } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://restapi.fax.plus/v3/accounts/{user_id}", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` -------------------------------- ### Install faxplus-api Python Package Source: https://apidoc.fax.plus/backend-sdks/python Install the package from PyPi or directly from Github using pip. ```bash # From PyPi pip install faxplus-api # Directly from Github pip install git+https://github.com/alohi/faxplus-python.git ``` -------------------------------- ### Get Fax Record with Go Source: https://apidoc.fax.plus/api-reference/endpoints/faxes/get-a-fax-record This Go code snippet demonstrates how to make a GET request to retrieve a fax record. It includes setting up headers for `Accept`, `Authorization`, and `x-fax-clientid`. ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ // The x-fax-clientid header is required only when using the OAuth2 token scheme "Accept": []string{"application/json"}, "Authorization": []string{"Bearer {access-token}"}, "x-fax-clientid": []string{"YOUR_CLIENT_ID"} } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://restapi.fax.plus/v3/accounts/{user_id}/faxes/{fax_id}", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` -------------------------------- ### List Contacts with PHP Source: https://apidoc.fax.plus/api-reference/endpoints/contacts/list-contacts This PHP example uses Guzzle HTTP client to fetch contacts. Ensure you have Guzzle installed via Composer. The 'x-fax-clientid' header is mandatory for OAuth2 token authentication. ```php 'application/json', 'Authorization' => 'Bearer {access-token}', // The x-fax-clientid header is required only when using the OAuth2 token scheme 'x-fax-clientid' => '{client ID}', ); $client = new GuzzleHttp\Client(); try { $response = $client->request('GET','https://restapi.fax.plus/v3/accounts/self/contacts?search=&offset=0&limit=50', array( 'headers' => $headers, ) ); print_r($response->getBody()->getContents()); } catch (GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` -------------------------------- ### Get Fax Confirmation Report in Go Source: https://apidoc.fax.plus/api-reference/endpoints/files/get-fax-confirmation-report Demonstrates making a GET request in Go to retrieve a fax confirmation report. Includes setting headers for authorization, client ID, and accept type. ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ // The x-fax-clientid header is required only when using the OAuth2 token scheme "Accept": []string{"application/pdf"}, "Authorization": []string{"Bearer {access-token}"}, "x-fax-clientid": []string{"YOUR CLIENT_ID"} } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://restapi.fax.plus/v3/accounts/{user_id}/report/{fax_id}", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` -------------------------------- ### Create Contact with Go HTTP Client Source: https://apidoc.fax.plus/api-reference/endpoints/contacts/create-contact This Go example shows how to create a contact using the standard net/http package. Ensure the correct headers, including client ID and authorization, are set. ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ // The x-fax-clientid header is required only when using the OAuth2 token scheme "Content-Type": []string{"application/json"}, "Accept": []string{"application/json"}, "Authorization": []string{"Bearer {access-token}"}, "x-fax-clientid": []string{"YOUR_CLIENT_ID"} } jsonBody := []byte(`{"name":"John Doe","company":"Acme Corp","numbers":["+1234567890"],"emails":["john@example.com"],"address":"123 Main St","notes":"Important client"}`) data := bytes.NewBuffer(jsonBody) req, err := http.NewRequest("POST", "https://restapi.fax.plus/v3/accounts/self/contacts", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` -------------------------------- ### List Webhooks with Java Source: https://apidoc.fax.plus/api-reference/endpoints/webhooks/list-user-webhooks This Java example demonstrates fetching webhooks using Apache HTTP Client. It constructs the URL with the event parameter and includes necessary headers like `Accept`, `Authorization`, and `x-fax-clientid` for OAuth2. ```java /** * Example below uses Apache HTTP Client 4 with Fluent API **/ String url = "https://restapi.fax.plus/v3/hooks?event=fax_received"; String result = Request .Get(url) // The x-fax-clientid header is required only when using the OAuth2 token scheme .addHeader("x-fax-clientid", "YOUR_CLIENT_ID") .addHeader("Accept", "'application/json'") .addHeader("Authorization", "'Bearer {access-token}'") .execute() .returnContent().asString(); System.out.println(result.toString()); ``` -------------------------------- ### Make HTTP Request using Go Source: https://apidoc.fax.plus/get-started/quickstart Make an HTTP request using Go's standard library. This example demonstrates setting headers for authorization and client ID. ```go package main import ( "bytes" "net/http" ) func main() { package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ // The x-fax-clientid header is required only when using the OAuth2 token scheme "Accept": []string{"application/pdf"}, "Authorization": []string{"Bearer {access-token}"}, "x-fax-clientid": []string{"{client-id}"} } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://restapi.fax.plus/v3/accounts/{user_id}/report/{fax_id}", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } } ``` -------------------------------- ### Get Outgoing Fax Details with Java Source: https://apidoc.fax.plus/api-reference/endpoints/outbox/list-outgoing-faxes Example using Apache HTTP Client 4 with Fluent API to get outgoing fax details. Remember to replace placeholders with your actual client ID and access token. ```java /** * Example below uses Apache HTTP Client 4 with Fluent API **/ Map pathParams = new HashMap<>(); pathParams.put("user_id", "'13d8z73c'"); pathParams.put("outbox_fax_id", "'132esd4cs31'"); StrSubstitutor sub = new StrSubstitutor(values, "{", "}"); String url = sub.replace("https://restapi.fax.plus/v3/accounts/{user_id}/outbox/{outbox_fax_id}"); String result = Request .Get(url) // The x-fax-clientid header is required only when using the OAuth2 token scheme .addHeader("x-fax-clientid", "YOUR CLIENT_ID") .addHeader("Accept", "'application/json'") .addHeader("Authorization", "'Bearer {access-token}'") .execute() .returnContent().asString(); System.out.println(result.toString()); ``` -------------------------------- ### Get Fax Record with Java Source: https://apidoc.fax.plus/api-reference/endpoints/faxes/get-a-fax-record Example using Apache HTTP Client 4 with Fluent API to get a fax record. The URL requires `user_id` and `fax_id`. Remember to include the `x-fax-clientid` header if using OAuth2. ```java /** * Example below uses Apache HTTP Client 4 with Fluent API **/ Map pathParams = new HashMap<>(); pathParams.put("user_id", "'13d8z73c'"); pathParams.put("fax_id", "'132esd4cs31'"); StrSubstitutor sub = new StrSubstitutor(values, "{", "}"); String url = sub.replace("https://restapi.fax.plus/v3/accounts/{user_id}/faxes/{fax_id}"); String result = Request .Get(url) // The x-fax-clientid header is required only when using the OAuth2 token scheme .addHeader("x-fax-clientid", "YOUR_CLIENT_ID") .addHeader("Accept", "'application/json'") .addHeader("Authorization", "'Bearer {access-token}'") .execute() .returnContent().asString(); System.out.println(result.toString()); ``` -------------------------------- ### Get Outgoing Fax Details with cURL Source: https://apidoc.fax.plus/api-reference/endpoints/outbox/list-outgoing-faxes A cURL command to retrieve outgoing fax details. This example includes necessary headers for authentication and content type. ```bash # You can also use wget curl -X GET https://restapi.fax.plus/v3/accounts/{user_id}/outbox/{outbox_fax_id} \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' \ # The x-fax-clientid header is required only when using the OAuth2 token scheme -H 'x-fax-clientid: "YOUR CLIENT_ID"' ``` -------------------------------- ### List Phone Numbers with Go Source: https://apidoc.fax.plus/api-reference/endpoints/numbers/list-phone-numbers Demonstrates how to list phone numbers using Go's standard http package. Ensure the 'x-fax-clientid' header is included if using OAuth2. ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ // The x-fax-clientid header is required only when using the OAuth2 token scheme "Accept": []string{"application/json"}, "Authorization": []string{"Bearer {access-token}"}, "x-fax-clientid": []string{"YOUR CLIENT_ID"} } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://restapi.fax.plus/v3/accounts/{user_id}/numbers", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` -------------------------------- ### List Corporate Members with Go Source: https://apidoc.fax.plus/api-reference/endpoints/accounts/list-corporate-members Demonstrates how to make a GET request to list corporate members using Go's net/http package. Includes necessary headers for authentication and content type. ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ // The x-fax-clientid header is required only when using the OAuth2 token scheme "Accept": []string{"application/json"}, "Authorization": []string{"Bearer {access-token}"}, "x-fax-clientid": []string{"YOUR_CLIENT_ID"} } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://restapi.fax.plus/v3/accounts", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` -------------------------------- ### Get Fax Record with PHP Source: https://apidoc.fax.plus/api-reference/endpoints/faxes/get-a-fax-record This PHP example uses Guzzle HTTP client to fetch a fax record. It shows how to set the necessary headers, including `Accept`, `Authorization`, and `x-fax-clientid`. ```php 'application/json', 'Authorization' => 'Bearer {access-token}', // The x-fax-clientid header is required only when using the OAuth2 token scheme 'x-fax-clientid' => '{client ID}', ); $client = new GuzzleHttp Client(); try { $response = $client->request('GET','https://restapi.fax.plus/v3/accounts/{user_id}/faxes/{fax_id}', array( 'headers' => $headers, ) ); print_r($response->getBody()->getContents()); } catch (GuzzleHttp Exception BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` -------------------------------- ### Create Contact with Java (Apache HTTP Client) Source: https://apidoc.fax.plus/api-reference/endpoints/contacts/create-contact This Java example demonstrates creating a contact using Apache HTTP Client 4 with its Fluent API. Remember to replace placeholders for client ID and access token. ```java String url = "https://restapi.fax.plus/v3/accounts/self/contacts"; String jsonBody = "{\"name\":\"John Doe\",\"company\":\"Acme Corp\",\"numbers\":[\"+1234567890\"],\"emails\":[\"john@example.com\"],\"address\":\"123 Main St\",\"notes\":\"Important client\"}"; String result = Request .Post(url) // The x-fax-clientid header is required only when using the OAuth2 token scheme .addHeader("x-fax-clientid", "YOUR_CLIENT_ID") .addHeader("Content-Type", "application/json") .addHeader("Accept", "'application/json'") .addHeader("Authorization", "'Bearer {access-token}'") .bodyString(jsonBody, ContentType.APPLICATION_JSON) .execute() .returnContent().asString(); System.out.println(result.toString()); ``` -------------------------------- ### Send Fax with Javascript Source: https://apidoc.fax.plus/get-started/quickstart This Javascript example uses the `@alohi/faxplus-api` library to send a fax. Ensure you have the library installed and replace `accessToken` and `clientId` with your credentials. The `x-fax-clientid` header is required for OAuth2 tokens. ```javascript const axios = require('axios'); const OutboxApiFp = require('@alohi/faxplus-api').OutboxApiFp; const Configuration = require('@alohi/faxplus-api').Configuration; const config = new Configuration({ accessToken: accessToken, basePath: 'https://restapi.fax.plus/v3', // Header required only when using the OAuth2 token scheme baseOptions: { headers: { "x-fax-clientid": clientId, } } }); async function sendFax() { const reqParams = { "userId": '13d8z73c', "payloadOutbox": { "comment": { "tags": [ "tag1", "tag2" ], "text": "text comment" }, "files": [ "filetosend.pdf" ], "from": "+12345667", "options": { "enhancement": true, "retry": { "count": 2, "delay": 15 } }, "send_time": "2000-01-01 01:02:03 +0000", "to": [ "+12345688", "+12345699" ], "return_ids": true } } const req = await OutboxApiFp(config).sendFax(reqParams); const resp = await req(axios); } sendFax() ``` -------------------------------- ### Get Fax Confirmation Report using cURL Source: https://apidoc.fax.plus/api-reference/endpoints/files/get-fax-confirmation-report Command-line example using cURL to retrieve a fax confirmation report. Set the Accept and Authorization headers, and include the x-fax-clientid if using OAuth2. ```bash # You can also use wget curl -X GET https://restapi.fax.plus/v3/accounts/{user_id}/report/{fax_id} \ -H 'Accept: application/pdf' \ -H 'Authorization: Bearer {access-token}' \ # The x-fax-clientid header is required only when using the OAuth2 token scheme -H 'x-fax-clientid: "YOUR CLIENT_ID"' ``` -------------------------------- ### List Webhooks with PHP Source: https://apidoc.fax.plus/api-reference/endpoints/webhooks/list-user-webhooks This PHP example uses Guzzle HTTP client to fetch webhooks. It sets up the necessary headers, including `Accept`, `Authorization`, and `x-fax-clientid` for OAuth2, and handles potential API errors. ```php 'application/json', 'Authorization' => 'Bearer {access-token}', // The x-fax-clientid header is required only when using the OAuth2 token scheme 'x-fax-clientid' => '{client ID}', ); $client = new GuzzleHttp try { $response = $client->request('GET','https://restapi.fax.plus/v3/hooks', array( 'headers' => $headers, ) ); print_r($response->getBody()->getContents()); } catch (GuzzleHttp // ... ?> ``` -------------------------------- ### Invite Members using Go Source: https://apidoc.fax.plus/api-reference/endpoints/accounts/invite-corporate-members Implement member invitations in Go by making a POST request to the API. Include necessary headers like Authorization and x-fax-clientid. ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ // The x-fax-clientid header is required only when using the OAuth2 token scheme "Accept": []string{"application/json"}, "Content-Type": []string{"application/json"}, "Authorization": []string{"Bearer {access-token}"}, "x-fax-clientid": []string{"YOUR_CLIENT_ID"} } jsonBody := []byte(`["user1@example.com", "user2@example.com"]`) data := bytes.NewBuffer(jsonBody) req, err := http.NewRequest("POST", "https://restapi.fax.plus/v3/accounts/self/member-invitations", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` -------------------------------- ### Get Fax Confirmation Report in PHP Source: https://apidoc.fax.plus/api-reference/endpoints/files/get-fax-confirmation-report PHP example using Guzzle HTTP client to request a fax confirmation report. Ensure to include necessary headers like Authorization and x-fax-clientid. ```php 'application/json', 'Authorization' => 'Bearer {access-token}', // The x-fax-clientid header is required only when using the OAuth2 token scheme 'x-fax-clientid' => '{client ID}', ); $client = new GuzzleHttp Client(); try { $response = $client->request('GET','https://restapi.fax.plus/v3/accounts/{user_id}/report/{fax_id}', array( 'headers' => $headers, ) ); print_r($response->getBody()->getContents()); } catch (GuzzleHttp Exception BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` -------------------------------- ### Get Outgoing Fax Details with PHP Source: https://apidoc.fax.plus/api-reference/endpoints/outbox/list-outgoing-faxes This PHP snippet uses the Guzzle HTTP client to fetch outgoing fax details. Ensure you have Guzzle installed via Composer and replace placeholders with your credentials. ```php 'application/json', 'Authorization' => 'Bearer {access-token}', // The x-fax-clientid header is required only when using the OAuth2 token scheme 'x-fax-clientid' => '{client ID}', ); $client = new GuzzleHttp Client(); try { $response = $client->request('GET','https://restapi.fax.plus/v3/accounts/{user_id}/outbox/{outbox_fax_id}', array( 'headers' => $headers, ) ); print_r($response->getBody()->getContents()); } catch (GuzzleHttp Exception BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ?> ``` -------------------------------- ### Get Account Information with PHP Source: https://apidoc.fax.plus/get-started/quickstart Use this PHP snippet with Guzzle HTTP to retrieve account details. Ensure you have the Guzzle HTTP client installed and replace placeholders with your actual access token and client ID. ```php $headers = array( 'Accept' => 'application/json', 'Authorization' => 'Bearer {access-token}', 'x-fax-clientid' => '{client-id}', ); $client = new GuzzleHttp Client(); try { $response = $client->request('GET', 'https://restapi.fax.plus/v3/accounts', array( 'headers' => $headers, )); print_r($response->getBody()->getContents()); } catch (GuzzleHttp Exception BadResponseException $e) { print_r($e->getMessage()); } ``` -------------------------------- ### Get User Information (NodeJS SDK) Source: https://apidoc.fax.plus/api-reference/endpoints/accounts/get-account-information Use this snippet to retrieve user details via the NodeJS SDK. Ensure you have the `axios` and `@alohi/faxplus-api` packages installed and configured with your access token, client ID, and base path. ```javascript const axios = require('axios'); const AccountsApiFp = require('@alohi/faxplus-api').AccountsApiFp; const Configuration = require('@alohi/faxplus-api').Configuration; const config = new Configuration({ accessToken: accessToken, basePath: 'https://restapi.fax.plus/v3', // Header required only when using the OAuth2 token scheme baseOptions: { headers: { "x-fax-clientid": clientId, } } }); async function getUser() { const reqParams = { "userId": '473e1eb6' } const req = await AccountsApiFp(config).getUser(reqParams); const resp = await req(axios); } getUser() ``` -------------------------------- ### Invite Members using Python SDK Source: https://apidoc.fax.plus/api-reference/endpoints/accounts/invite-corporate-members Utilize the Python SDK for inviting members. Configure the API client with your access token and necessary headers. ```python from faxplus import ApiClient, AccountsApi from faxplus.configuration import Configuration conf = Configuration() conf.access_token = access_token # header_name and header_value required only when using the OAuth2 token scheme api_client = ApiClient(header_name='x-fax-clientid', header_value=client_id, configuration=conf) api = AccountsApi(api_client) emails = ["user1@example.com", "user2@example.com"] resp = api.invite_members(emails) ``` -------------------------------- ### Create Contact with PHP Guzzle Source: https://apidoc.fax.plus/api-reference/endpoints/contacts/create-contact This PHP example uses the Guzzle HTTP client to create a contact. It includes setting the necessary headers and the JSON request body. Make sure to install Guzzle via Composer. ```php 'application/json', 'Accept' => 'application/json', 'Authorization' => 'Bearer {access-token}', // The x-fax-clientid header is required only when using the OAuth2 token scheme 'x-fax-clientid' => '{client ID}', ); $client = new GuzzleHttp Client(); $body = array( 'name' => 'John Doe', 'company' => 'Acme Corp', 'numbers' => array('+1234567890'), 'emails' => array('john@example.com'), 'address' => '123 Main St', 'notes' => 'Important client' ); try { $response = $client->request('POST','https://restapi.fax.plus/v3/accounts/self/contacts', array( 'headers' => $headers, 'json' => $body, ) ); print_r($response->getBody()->getContents()); } catch (GuzzleHttp Exception BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` -------------------------------- ### List Fax Records with Go Source: https://apidoc.fax.plus/api-reference/endpoints/faxes/list-fax-records Example of listing fax records using Go's standard http package. The 'x-fax-clientid' header is necessary for OAuth2 authentication. ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ // The x-fax-clientid header is required only when using the OAuth2 token scheme "Accept": []string{"application/json"}, "Authorization": []string{"Bearer {access-token}"}, "x-fax-clientid": []string{"YOUR_CLIENT_ID"} } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://restapi.fax.plus/v3/accounts/{user_id}/faxes", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` -------------------------------- ### Get Outgoing Fax Details with NodeJS SDK Source: https://apidoc.fax.plus/api-reference/endpoints/outbox/list-outgoing-faxes Use this snippet to fetch details of a specific fax in the outbox using the NodeJS SDK. Ensure you have the SDK installed and configured with your access token, client ID, and base path. ```javascript const axios = require('axios'); const OutboxApiFp = require('@alohi/faxplus-api').OutboxApiFp; const Configuration = require('@alohi/faxplus-api').Configuration; const config = new Configuration({ accessToken: accessToken, basePath: 'https://restapi.fax.plus/v3', // Header required only when using the OAuth2 token scheme baseOptions: { headers: { "x-fax-clientid": clientId, } } }); async function getOutboxFax() { const reqParams = { "userId": '13d8z73c', "outboxFaxId": '132esd4cs31' } const req = await OutboxApiFp(config).getOutboxFax(reqParams); const resp = await req(axios); } getOutboxFax() ``` -------------------------------- ### Register Webhook with Java (Apache HTTP Client) Source: https://apidoc.fax.plus/api-reference/endpoints/webhooks/register-new-webhook Example of registering a webhook using Java with Apache HTTP Client. It demonstrates setting the URL, headers, and request body. ```java /** * Example below uses Apache HTTP Client 4 with Fluent API **/ String url = "https://restapi.fax.plus/v3/hooks"; String jsonBody = ...; // See request body example String result = Request .Post(url) // The x-fax-clientid header is required only when using the OAuth2 token scheme .addHeader("x-fax-clientid", "YOUR_CLIENT_ID") .addHeader("Content-Type", "'application/json'") .addHeader("Accept", "'application/json'") .addHeader("Authorization", "'Bearer {access-token}'") .bodyString(jsonBody, "application/json") .execute() .returnContent().asString(); System.out.println(result.toString()); ``` -------------------------------- ### Get Fax Confirmation Report in Java Source: https://apidoc.fax.plus/api-reference/endpoints/files/get-fax-confirmation-report Example using Apache HTTP Client 4 with Fluent API to retrieve a fax confirmation report. Requires setting path parameters, headers including client ID, and authorization. ```java /** * Example below uses Apache HTTP Client 4 with Fluent API **/ Map pathParams = new HashMap<>(); pathParams.put("user_id", "'13d8z73c'"); pathParams.put("fax_id", "'132esd4cs31'"); StrSubstitutor sub = new StrSubstitutor(values, "{", "}"); String url = sub.replace("https://restapi.fax.plus/v3/accounts/{user_id}/report/{fax_id}"); String result = Request .Get(url) // The x-fax-clientid header is required only when using the OAuth2 token scheme .addHeader("x-fax-clientid", "YOUR CLIENT_ID") .addHeader("Accept", "'application/pdf'") .addHeader("Authorization", "'Bearer {access-token}'") .execute() .returnContent().asString(); System.out.println(result.toString()); ``` -------------------------------- ### List Fax Records with Java Source: https://apidoc.fax.plus/api-reference/endpoints/faxes/list-fax-records This Java example demonstrates fetching fax records using Apache HTTP Client. Remember to include the 'x-fax-clientid' header if using OAuth2. ```java /** * Example below uses Apache HTTP Client 4 with Fluent API **/ Map pathParams = new HashMap<>(); pathParams.put("user_id", "'13d8z73c'"); StrSubstitutor sub = new StrSubstitutor(values, "{", "}"); String url = sub.replace("https://restapi.fax.plus/v3/accounts/{user_id}/faxes"); String result = Request .Get(url) // The x-fax-clientid header is required only when using the OAuth2 token scheme .addHeader("x-fax-clientid", "YOUR_CLIENT_ID") .addHeader("Accept", "'application/json'") .addHeader("Authorization", "'Bearer {access-token}'") .execute() .returnContent().asString(); System.out.println(result.toString()); ``` -------------------------------- ### Get User Information (Python SDK) Source: https://apidoc.fax.plus/api-reference/endpoints/accounts/get-account-information This Python snippet demonstrates fetching user information using the fax.plus SDK. Configure the `ApiClient` with your access token and optionally the `x-fax-clientid` header for OAuth2 authentication. ```python from faxplus import ApiClient, AccountsApi from faxplus.configuration import Configuration conf = Configuration() conf.access_token = access_token # header_name and header_value required only when using the OAuth2 token scheme api_client = ApiClient(header_name='x-fax-clientid', header_value=client_id, configuration=conf) api = AccountsApi(api_client) resp = api.get_user( user_id='473e1eb6') ``` -------------------------------- ### Get number information Source: https://apidoc.fax.plus/llms.txt Get information about a single purchased/assigned fax number. ```APIDOC ## Get number information ### Description Get information about a single purchased/assigned fax number. ### Scopes - fax:all:read - fax:numbers:read ``` -------------------------------- ### Get outgoing fax Source: https://apidoc.fax.plus/llms.txt Get specific details of a fax currently scheduled for sending. ```APIDOC ## Get outgoing fax ### Description Get specific details of a fax currently scheduled for sending. ### Scopes - fax:all:read - fax:fax:read ``` -------------------------------- ### Register Webhook with Go Source: https://apidoc.fax.plus/api-reference/endpoints/webhooks/register-new-webhook This Go code snippet shows how to make an HTTP POST request to register a webhook. It includes setting up headers and the request body. ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ // The x-fax-clientid header is required only when using the OAuth2 token scheme "Content-Type": []string{"application/json"}, "Accept": []string{"application/json"}, "Authorization": []string{"Bearer {access-token}"}, "x-fax-clientid": []string{"YOUR_CLIENT_ID"} } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("POST", "https://restapi.fax.plus/v3/hooks", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ```