Jump to content

Help with API

Go to solution Solved by requinix,

Recommended Posts

Hi all

I am pretty new to php and API, and would appreciate any help or at least if you can forward me in the right direction with this.

I have a working php file and I need to request some data from API. The third part who is handling API, has sent me the following code... 

What I am looking for is a basic sample code to understand how to get the data.


Any help is highly appreciated.


    "info": {
        "_postman_id": "3699c117-da38-4c11-93fe-451bae0bf8e4",
        "name": "AClock",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    "item": [
            "name": "ListDevicesDB",
            "request": {
                "method": "GET",
                "header": [
                        "key": "token",
                        "type": "text",
                        "value": "X1h36&YOoiKR"
                "url": {
                    "raw": "",
                    "protocol": "http",
                    "host": [
                    "port": "6600",
                    "path": [
                    "query": [
                            "key": "deviceSerial",
                            "value": "BJ2C193661559",
                            "disabled": true
                "description": "it provides a list of all devices that connected to the server. it is sorted by the time each device connected to server last time.\r\nyou can pass the \"deviceSerial\" to find a specific device OR skip this parameter to list all devices."
            "response": []




Link to comment
Share on other sites

  • Solution

That describes the "ListDevicesDB" API you can call.

1. It uses the GET method.
2. You need to include a "token" header that includes some value. If the value is what you included in your post then that needs to change because this was (probably) supposed to be a secret value and you've now shared it with the whole internet.
3. The URL is as given there. It optionally supports a "deviceSerial" query string parameter, as the description indicates.
4. It doesn't describe what the return value is.

So you need to get a basic API calling thing in place. You can use libraries for it, or you can write the API calls yourself using cURL.

Your first step should be to understand more about making API calls through PHP. It's all the same everywhere - only differences being exactly what the API wants, and that's the information they gave you.
Once you understand a little more about API calls, then you can deal with the PHP code to try to make them. It's pretty simple but you do need to know more about what this is all about to be effective at it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.