https://developer.zendesk.com/rest_api/docs/nps-api/responses#create-response
198109
def nps_survey_response_create(self, survey_id, data, **kwargs):
        ""
        api_path = "/api/v2/nps/surveys/{survey_id}/responses.json"
        api_path = api_path.format(survey_id=survey_id)
        return self.call(api_path, method="POST", data=data, **kwargs)
647241
def make_response(self,
                      data: Any = None,
                      **kwargs: Any) -> Any:
        
        """
        if not self._valid_request:
            logger.error('Request not validated, cannot make response')
            raise self.make_error('Request not validated before, cannot make '
                                  'response')

        if data is None and self.response_factory is None:
            logger.error('Response data omit, but no response factory is used')
            raise self.make_error('Response data could be omitted only when '
                                  'response factory is used')

        response_schema = getattr(self.module, 'response', None)
        if response_schema is not None:
            self._validate(data, response_schema)

        if self.response_factory is not None:
            return self.response_factory(
                *([data] if data is not None else []),
                **kwargs)
        return data
980876
def make_response(status, headers, payload, environ):
    
    headers_dict = {}
    content_type = None
    for h in headers:
        if h[0].lower() == 'content-type':
            content_type = h[1]
        else:
            headers_dict[h[0]] = h[1]
    return HTTPResponse(body_bytes=payload, content_type=content_type,
                        status=int(status.split()[0]), headers=headers_dict)
233376
public CreateDepartmentResponse create(QYDepartment department) {
        BeanUtil.requireNonNull(department, "department is null");
        CreateDepartmentResponse response;
        String url = BASE_API_URL + "cgi-bin/department/create?access_token=#";
        BaseResponse r = executePost(url, department.toJsonString());
        String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
        response = JSONUtil.toBean(resultJson, CreateDepartmentResponse.class);
        return response;
    }
833840
def create_authn_query_response(self, subject, session_index=None,
                                    requested_context=None, in_response_to=None,
                                    issuer=None, sign_response=False,
                                    status=None, sign_alg=None, digest_alg=None,
                                    **kwargs):
        

        margs = self.message_args()
        asserts = []
        for statement in self.session_db.get_authn_statements(
                subject.name_id, session_index, requested_context):
            asserts.append(saml.Assertion(authn_statement=statement,
                                          subject=subject, **margs))

        if asserts:
            args = {"assertion": asserts}
        else:
            args = {}

        return self._response(in_response_to, "", status, issuer,
                              sign_response, to_sign=[], sign_alg=sign_alg,
                              digest_alg=digest_alg, **args)
1241669
def create_response(self, request, image, content_type):
        """"""

        return HttpResponse(content=image, content_type=content_type)
1313452
async function _createSite() {
  const endpoint = url.resolve(apiURL, '/sites');
  const response = await got.post(endpoint, { json: true, headers: _bearer() });

  return response.body.site.id;
}
1012855
def build_response(content, code=200):
    """"""
    response = make_response( jsonify(content), content['code'] )
    response.headers['Access-Control-Allow-Origin'] = '*'
    response.headers['Access-Control-Allow-Headers'] = \
            'Origin, X-Requested-With, Content-Type, Accept, Authorization'
    return response
1072418
def _create(self, uri, body, return_none=False, return_raw=False,
            return_response=None, **kwargs):
        
        self.run_hooks("modify_body_for_create", body, **kwargs)
        resp, resp_body = self.api.method_post(uri, body=body)
        if return_none:
            # No response body
            return
        elif return_response:
            return resp
        elif return_raw:
            if self.response_key:
                return resp_body[self.response_key]
            else:
                return resp_body
        return self.resource_class(self, resp_body, self.response_key)
1115793
function (res, res_obj) {

    // return response if exist, otherwise response might be returned 
    // AFTER some callback is done handling (i.e., response will be returned within the handler)
    if (typeof res_obj === 'string') {
        LOG.sys('replying a string: ' + res_obj);
        res.writeHead(200, {'Content-Type': 'text/plain'});                     
        res.end(res_obj);            
    }
    else {
        LOG.sys('replying a JSON: ' + JSON.stringify(res_obj));
        res.writeHead(200, {'Content-Type': 'application/json'});                     
        res.end(JSON.stringify(res_obj));        
    }
}
1242223
def _make_request(self, type, path, args, noRetry=False):
        
        response = getattr(requests, type)(path, headers = self._add_auth_headers(_JSON_HEADERS), **args)
        if response.status_code == 200 or response.status_code == 201:
            return response.json()
        elif not noRetry and self._is_expired_response(response) \
          and 'refresh_token' in self.creds:
            try:
                self.exchange_refresh_token()
            except TokenEndpointError:
                raise _rest_error_from_response(response)
            return self._make_request(type, path, args, noRetry = True)
        raise _rest_error_from_response(response)
577533
def create_post(self, title, body, board, category, username):
    '''

    '''

    category_url = "%s/categories.json" % board
    response = requests.get(category_url)

    if response.status_code != 200:
        print('Error with retrieving %s' % category_url)
        sys.exit(1)

    # Get a list of all categories
    categories = response.json()['category_list']['categories']
    categories = {c['name']:c['id'] for c in categories}

    # And if not valid, warn the user
    if category not in categories:
        bot.warning('%s is not valid, will use default' % category)

    category_id = categories.get(category, None)

    headers = {"Content-Type": "application/json",
               "User-Api-Client-Id": self.client_id,
               "User-Api-Key": self.token }


    # First get the category ids
    data = {'title': title,
            'raw': body,
            'category': category_id}

    response = requests.post("%s/posts.json" % board,
                             headers=headers,
                             data=json.dumps(data))

    if response.status_code in [200, 201, 202]:
        topic = response.json()
        url = "%s/t/%s/%s" %(board, topic['topic_slug'], topic['topic_id'])
        bot.info(url)
        return url

    elif response.status_code == 404:
        bot.error('Cannot post to board, not found. Do you have permission?')
        sys.exit(1)

    else:
        bot.error('Cannot post to board %s' % board)
        bot.error(response.content)
        sys.exit(1)
810067
@POST
    @Path("{group}/{id}")
    @Consumes("application/x.json-create-role")
    public Response createRoleFromUpdateRequest(@PathParam("group") String group, @PathParam("id") String id,
                                                CreateEmoRoleRequest request,
                                                @Authenticated Subject subject) {
        _uac.createRole(subject, request.setRoleKey(new EmoRoleKey(group, id)));
        return Response.created(URI.create(""))
                .entity(SuccessResponse.instance())
                .build();
    }
191846
private ObjectNode createResponseSuccess(String jsonRpc, Object id, JsonNode result) {
		ObjectNode response = mapper.createObjectNode();
		response.put(JSONRPC, jsonRpc);
		if (Integer.class.isInstance(id)) {
			response.put(ID, Integer.class.cast(id).intValue());
		} else if (Long.class.isInstance(id)) {
			response.put(ID, Long.class.cast(id).longValue());
		} else if (Float.class.isInstance(id)) {
			response.put(ID, Float.class.cast(id).floatValue());
		} else if (Double.class.isInstance(id)) {
			response.put(ID, Double.class.cast(id).doubleValue());
		} else if (BigDecimal.class.isInstance(id)) {
			response.put(ID, BigDecimal.class.cast(id));
		} else {
			response.put(ID, String.class.cast(id));
		}
		response.set(RESULT, result);
		return response;
	}
369485
def create_response(self, request, content, content_type):
        """"""

        return HttpResponse(content=content, content_type=content_type)
903434
def community_post_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/community/posts.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
1221669
def get_or_create_from_legacy_response(self, response, **kwargs):
        '''
        
        '''
        response_cls = self.response_class(**kwargs).get_or_create(**kwargs)
        if not getattr(response_cls, self.column):
            setattr(response_cls, self.column, self.accessor(response))
            _action_and_commit(response_cls, session.add)
        if not getattr(response_cls, self.venue_column):
            setattr(
                response_cls, self.venue_column, self.venue_accessor(response))
            _action_and_commit(response_cls, session.add)