Follow

How to Use Specific API Requests?

topic.pngThe article covers the following topics:

API request for affiliate creation

https://api.affise.com/docs3.1/#new-affiliate

If there are some custom sign-in fields, some of them are required - then you need to fill them in via API. 

  1. Add &custom_fields= parameter

  2. Make API request to all custom fields existent in account: 

https://api.affise.com/docs3.1/#custom-fields-list

import.pngBy using this method you will see only fields that have the “View” flag ticked.

1.png

In Insomnia it looks like:

111.png

Where:

  • custom_fields - is the name of the parameter
  • [123] - is an ID of a certain custom field. IDs of custom fields are depicted in a response to API requests to custom fields.

The value you need to indicate in the &custom_fields= parameter depends on the type of a certain custom field.

There are the following types:

Text: the value is specified as a regular text. Type whatever you want.

3.png

Select: the value is specified as a serial number of available options. 

An example: there are two available options: “Telegram” and “Viber” and you want to select “Telegram”. Then type “1” in a value field (see the screenshot below).

As the “Select” type of a field allows ticking only one option, the parameter should look like this: 

4.png

Checkbox: the value is specified as a serial number of available options. As the “Checkbox” type of a field allows ticking several flags, the parameter should look like this:

5.png

Radio: the value is specified as a serial number of available options. 

An example: there are two available options: “Yes” and “No” and you want to specify “Yes”. Then type “1” in a value field (see the screenshot below).

As the “Radio” type of a field allows ticking only one option, the parameter should look like this: 

6.png

Multiline text: the value is specified as a regular text. Type whatever you want. This type of field supposes typing text by lines. 

In Insomnia it should be done like that:

inslines.gif

In Postman it should be done like this:

postlines.gif

Hidden text: the value is specified as a regular text. Type whatever you want. (See “Text” example).

API requests to Statistics

In response to almost all requests to Statistics you will see “raw” and “uniq” in the “traffic” section:

23.png

Where:

  • Raw=clicks
  • Uniq=hosts

API request for adding/deleting a user's image

It is possible to upload an image for a user (user logo, user picture, user avatar) via API. To do it you need to use the API request for user editing:

https://api.affise.com/docs3.1/#add-user

Use the parameter 'avatar'. The image should be uploaded in Base64 format. To convert your picture into this format, use third-party services, like this one (free to use). 

import.pngWe support only JPEG format for image addition via API. If you would like to upload the PNG image - do it via UI. 

See the GIF:

Logobase64.gif

Then insert the copied code to the software you use (Postman, Insomnia, etc.).

logo.png

import.pngUploading the image via API doesn't allow cropping the image in the way you want, that's why we recommend using foursquare images with a size of 200x200 pixels approximately - otherwise, the image will be distorted or cropped automatically in a way you don't like. 

If you want to delete the picture via API, you need to make absolutely the same request, but without the parameter's value. Don't add the code of the image, but add the parameter 'avatar' itself and then send the request.

The cURL request for logo deleting:

curl --request POST \
--url https://api-rocketcompany.affse.com/3.0/admin/user/5c9b47a5c0417bbb008b4567 \
--header 'Api-key: c057faba8779ef56bdc493c' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data avatar=

API request for creatives deleting

  1. Make a GET request to an offer and copy creative ID

https://api.affise.com/docs3.1/#offer-by-id

432432.png
       2. Make a DELETE request with the creative ID in the creatives[] array in URL parameters 

 The example of the URL: 

https://api-rocketcompany.affise.com/3.0/admin/offer/18322/remove-creative?creatives[]=8da458f3-ce4d-4a49-9f96-e0203852df35&api-key=5a1bfd40a4209ef172cee375

234234.png

You need just the URL of the example shown above. No parameters, no headers are needed.

API request to update User’s Permissions

https://api.affise.com/docs3.1/#update-user-permissions

To edit permissions for a particular user you firstly need to get the full list of his current permissions.

Use this method to do it:

https://api.affise.com/docs3.1/#read-user

Then copy of the part of the response to this method: 

aaa.gif

It should start with 

{

   "permissions": {

And should end with 4 curly brackets: 

                       }
               }
        }
}

After that you need to create a new request in Insomnia/Postman with the following attributes:

  • POST method
  • JSON format of the body (not Form URL encoded)
  • Content type: application/json
  • Api-key: API key of General manager

Then you need to insert the whole copied block into the body of this request.

import.pngIf you leave “exceptions” arrays as they are, nothing will change. But if you change the value in the “level” parameter and leave the “exceptions” as they are, relevant permissions will be changed. An example: you had a “write” value in the “level” parameter, but changed that to the “deny” parameter and left the “exceptions” array as it is (you didn’t delete it). Then the relevant permission will be changed to “deny”. 

There is an example of a request in JSON format where some lists of exceptions were added (for “Access to affiliates editing” and “Access to advertisers editing” permissions):

{

    "permissions": {

        "general": {

            "marketplace": {

                "level": "read"

            },

            "settings": {

                "level": "write"

            }

        },

        "notificator": {

            "client-subscription": {

                "level": "deny"

            },

            "transport-configuration": {

                "level": "deny"

            },

            "user-subscription": {

                "level": "deny"

            }

        },

        "stats": {

            "affiliate-postback": {

                "level": "read"

            },

            "clicks-list": {

                "level": "read"

            },

            "comparison-report": {

                "level": "read"

            },

            "conversions-export": {

                "level": "read"

            },

            "conversions-import": {

                "level": "write"

            },

            "conversions-list": {

                "level": "read"

            },

            "entity-account-manager": {

                "level": "read",

                "default_level": "read"

            },

            "entity-affiliate-manager": {

                "level": "deny"

            },

            "referral": {

                "level": "deny"

            },

            "server-postback": {

                "level": "read"

            },

            "slice-account_manager_id": {

                "level": "deny"

            },

            "slice-advertiser_id": {

                "level": "deny"

            },

            "slice-affiliate_id": {

                "level": "read"

            },

            "slice-affiliate_manager_id": {

                "level": "deny"

            },

            "slice-browser": {

                "level": "deny"

            },

            "slice-city": {

                "level": "read"

            },

            "slice-connection-type": {

                "level": "deny"

            },

            "slice-country": {

                "level": "read"

            },

            "slice-day": {

                "level": "read"

            },

            "slice-device": {

                "level": "read"

            },

            "slice-goal": {

                "level": "read"

            },

            "slice-landing": {

                "level": "deny"

            },

            "slice-mobile-carrier": {

                "level": "deny"

            },

            "slice-offer_id": {

                "level": "read"

            },

            "slice-os": {

                "level": "read"

            },

            "slice-prelanding": {

                "level": "deny"

            },

            "slice-smart_id": {

                "level": "deny"

            },

            "slice-sub1": {

                "level": "deny"

            },

            "slice-sub2": {

                "level": "deny"

            },

            "slice-trafficback_reason": {

                "level": "read"

            },

            "stats-export": {

                "level": "read"

            },

            "view-custom": {

                "level": "read"

            },

            "view-kpi": {

                "level": "deny"

            },

            "view-retention-rate": {

                "level": "deny"

            }

        },

        "users": {

            "entity-account-manager": {

                "level": "deny"

            },

            "entity-advertiser": {

                "level": "write",

                "exceptions": {

                    "strings": {

                        "deny": [

                            "5c24b10a43cf7655008b4567",

                            "5da43e1d10768e44b351c2c5",

                            "5e2d96491d4b0b0738afb1b2",

                            "5e3aecd91d4b0b0738afb3d7",

                            "5cfa86cf43cf7676008b4604",

                            "5e58e3c6ac611cda7e576a89"

                        ],

                        "read": [

                            "5e7dba10c3d9b3f9f5dd31ff"

                        ]

                    }

                }

            },

            "entity-affiliate": {

            "level": "write",

            "exceptions": {

                "ints": {

                    "deny": [

                        2

                    ],

                    "read": [

                        5

                    ]

                }

            }

        },

            "entity-affiliate-manager": {

                "level": "deny"

            },

            "entity-common-manager": {

                "level": "deny"

            },

            "entity-preset": {

                "level": "deny"

            },

            "view-users": {

                "level": "deny"

            }

        }

    }

}

You need to specify IDs of certain affiliates/advertisers you want to add to a list of exceptions like it was done in the example above.

See the GIF:

permmm.gif

All API requests where you need to specify Currency ID

There are two API requests where you could use currency ID:

https://api.affise.com/docs3.1/#conversions

https://api.affise.com/docs3.1/#by-referral-payments

How to find a currency ID:

  1. Go Daily Statistics page
  2. Choose the needed currency you want to get conversions by:

currency.png

       3. Press the “Apply” button

       4. You will see currency ID in a browser’s address bar: 333.png

article.pngThe following articles can be helpful:

If you have any questions left on API, feel free to address them to Affise Technical Support Team via support@affise.com or your internal live-chat as long as to contact your Dedicated Account Manager.  

Written by Lizaveta Talkachova

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.