i currently have an apache module which when invoked performs a number of operations one of which is to modify a URL in the form of a string. I would subsequently like to redirect to this URL. Unfortunately there is not much documentation available to help me accomplish this, can someone who has done similar please advise?
thanks in advance
You can use the apr_table_add function with headers_out, that holds the response headers.
apr_table_add(r->headers_out, "Location", your_url);
return HTTP_MOVED_PERMANENTLY;
Related
i have an api(web service) in django like this:
http://127.0.0.1:9000/api/back_office/appointments/days/?branch=1
that in swagger i want to input query parameter named branch but don't work this(all of my Apis have same problem!!).
before, i use older version of swagger and for enter query parameters use like --param_name syntax, but now in django-rest-swagger==2.1.1 don't work this syntax.
can anyone help me?
Perhaps i should use get_customizations in OpenAPIRenderer class?
Thanks in advance.
For adding query parameters to swagger please, go through this post
I have built some RESTful api's with REstlet 2.3.4. I've been using HTTP_BASIC which let the browser prompt for credentials but it's time for a proper login form. I figure the easiest way to implement this is CookieAuthenticator. I can't find full working examples on github/google. I am sure i'm over looking them can someone provide a working example implementing CookieAuthenticator in Restlet?
I did get this to work after all. I have a longer answer here with some code examples. First, i was missing the fact that CookieAuthenticator is a filter and HAS the logic to handle login and logout. You need to create EMPTY ServerResources with a method annotated with #Post that has nothing in the body. Second, extend CookieAuthenticator and overwrite isLoggingIn(..) and isLoggingOut(..) with the code found in the link.
Cheers,
-ray
I'm trying to use the Yummly API. I've noticed that some of their developers have answered other questions here, so I'm hoping to catch their eye. I used the documentation at the yummly developer site https://developer.yummly.com/documentation#IDs.
Specifically here is my get request:
<http://api.yummly.com/v1/api/recipe/Avocado-cream-pasta-sauce-recipe-306039>
Which returns this:
Please include X-Yummly-App-ID and X-Yummly-App-Key
Seems like this is a sensible thing, except that I don't see anywhere in the documentation for the single recipe call where I'm supposed to insert that info. Any one out there know how to properly format this?
or include them as URL parameters:
_app_id=app-id&_app_key=app-key
https://developer.yummly.com/documentation#IDs
Try this:
http://api.yummly.com/v1/api/recipe/Avocado-cream-pasta-sauce-recipe-306039?_app_id=ID&_app_key=KEY
You need to take the URL you mentioned in the question and add your authentication parameters to it. So it becomes:
http://api.yummly.com/v1/api/recipe/Avocado-cream-pasta-sauce-recipe-306039?_app_id=ID&_app_key=KEY
Instead of ID and KEY insert the application id and key from your account on developer.yummly.com
I have written a module in apache which logs information when invoked lets say the url it is pointing at is localhost:12345/imp, i would like to subsequently after executing the code in this module redirect each request to different URL say for example www.cnn.com.
apr_table_add(r->headers_out, "Location","www.cnn.com" );
return HTTP_TEMPORARY_REDIRECT;
I have tried the above in my module however all it seems to do is call my module twice and it seems to be attempting to access localhost:12345/www/cnn/com. Surely there must be someone who has done similar to what i am attempting, can someone please advise?
Many thanks
The internet standard requires an absolute URI to follow a Location header, which means it must contain a scheme (e.g., http:, https:, telnet:, mailto:).
You should use :
apr_table_add(r->headers_out, "Location","http://www.cnn.com" );
I am using the concept of multiple languages in my project, and everything works fine.
But i am having some queries about my url.
When i am using this url www.asd.com/reg/?lang=es, then it display the data in spanish form.
But if i am using this url www.asd.com/reg/lang=es, then it does not display data in spanish.
The difference between two url is "?" , so can anybody suggest me some way with which I can accomplish my task without this "?"
Thanks
It's not possible to post variables without the ? in your URL. (more informations here)
If you want to manage it without the GET-Parameter (?lang) you need to rewrite the middleware I've posted to you. Also you need to modify your urls.py.
All you then may achieve is www.asd.com/reg/lang/es or http://es.asd.com/reg if you're familiar with subdomaining.