Discussions

Ask a Question

404 Error

Hello, I was working the API and I am trying to set up some error messages. When the domain name is not correct, the api should return a code of 404, which it does but inside the response. The http code is in fact 200 which is not correct. Here is my code: $slash_tag = $user.'/vehicle/'.$vehicle_id; echo console_log($slash_tag); $domain_data["fullName"] = "renntapasdas.com"; // messed up domain name $post_data["destination"] = $destination; $post_data["domain"] = $domain_data; $post_data["slashtag"] = $slash_tag; $post_data["title"] = $title; $ch = curl_init("https://api.rebrandly.com/v1/links"); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "apikey: NO!", // Do in fact have this but not showing it "Content-Type: application/json" )); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_data)); $result = curl_exec($ch); $response = json_decode($result, true); /* returns { "message": "Not found", "httpCode": 404, "code": "NotFound", "source": "domain", "id": "renntapasdas.com" } */ echo console_log("Link: ", $response); $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); // Should return a 404 but returns a 200 echo console_log("HTTP Code: ", $httpcode); curl_close($ch); if ($httpcode==403) { if ($response['errors'][0]['code'] == 'AlreadyExists') { return 'renntap.com/'.$slash_tag; } else { return ''; } } else if($httpcode==200) { // therefore this if statement is true when it shouldn't be return $response['shortUrl']; } else { return ''; } Any suggested work arounds?
ANSWERED

Shortening a URL with POST Parameters

I'm trying to shorten a URL with POST parameters (e.g. https://website.com/formdata?first=John&last=Smith&redirectURL=https://mysite.com) In this example, the "Destination" is returned as "https://mysite.com" instead of the complete URL (as expected). How do I prevent Rebrandly from interpreting the long URL?

Method to get link by destination

I am just getting started using the rebrandly API, and I was looking for a method to help me avoid re-creating short links that point to the same destination. i.e. either the ability to search my links by destination URL or if I try to create a link for a destination URL that already exists, return the previously created link instead of creating a new one. I saw another post that is a few years old that had responses indicating this might be a coming feature. Was this functionality added to the API somewhere and I'm just not seeing it? Thanks.
ANSWERED

Stuck on "SSL Certificate not active yet"

My domain has been stuck on "SSL Certificate not active yet" for over 48 hours. Is there something that can be done to resolve this?
ANSWERED

Any chance that a openApi (/swagger) specification for the API will be available soon?

Hi there Rebrandly, today I started evaluating your API and I really like it - especially the API Explorer - it's clean and easy to understand (just stopped the evaluation of Firebase Dynamic Links...) But having to parse the reponses by hand is tedious. I'd love to generate the API client code from an openAPI specification, which I've done in the past with this https://openapi-generator.tech/docs/plugins/ Any chance there is a rebrandly_api_v1.yaml to be found somewhere? Cheers, Benjamin
ANSWERED

Use API to expand the shortened link?

I would like to use the API to submit the shortened link and return the expanded original link. It's not clear from the API documentation how to do that. All it says is to send a GET to /links but where/how do I submit the shortened link?
ANSWERED

API requests links but not getting all of them

Hello, when i request API with /count, i get 214k links. But when i request 25 per 25 with a loop on Talend and the last parameter, i get 200299 links exactly, and it finishes by the right link (the last one of them all). I do an orderBy updatedAt, and sometimes i notice that some links are bypassed, when for example they have the same updateDate exactly. Do you have some solutions ? Thanks, Nathan
ANSWERED

shortening api

how can i shorten an api
ANSWERED

Get urlshortner by using library

rebrandly.links.create(params) need example for params
ANSWERED

access extended workspace API through Proxy server

Hi, How to access extended workspace API through Proxy server? Brajendra